Hi,
There is no examples of and, or, and not statements in our tutorials. Can i get some sample codings of and, or, and not.
thanks in advance
beginner and C++ lover
shaiju jose
This is a discussion on Examples for and, or , not statements within the C++ Programming forums, part of the General Programming Boards category; Hi, There is no examples of and, or, and not statements in our tutorials. Can i get some sample codings ...
Hi,
There is no examples of and, or, and not statements in our tutorials. Can i get some sample codings of and, or, and not.
thanks in advance
beginner and C++ lover
shaiju jose
Is this what your asking for?
Code:#include <iostream> using namespace std; int main() { int var_0 = 0, //0 is false var_1 = 1, //1 is true var_2 = 2, var_3 = 3; { cout<<"\nTHE BASICS\n"; if(!var_0) cout<<"\nThis prints because the if statement " <<"asks is var_0 false? Which is true because " <<"var_0 is equal to zero" <<endl; if(var_1) cout<<"\nThis prints because the if statement " <<"asks is var_1 true? Which is also true " <<"becasue var_1 is equal to one" <<endl; if(var_2 == 2 && var_3 == 3) cout<<"\nThis prints because the if statement " <<"asks is var_2 equal to 2 AND is var_3 " <<"equal to three? Which is also true" <<endl; if(var_2 == 2 || var_3 == 5) cout<<"\nThis prints because the if statement " <<"asks is var_2 equal to 2 OR is var_3 equal " <<"to 5? Which is also true because var_2 is " <<"equal to 2" <<endl; if(var_2 == var_3) cout<<"\nThis will not print because these two " <<"variables are not equal" <<endl; } return 0; }
Last edited by DISGUISED; 06-11-2002 at 10:28 PM.