Wednesday, 20 January 2016

// // Leave a Comment

LOGICAL AND RELATIONAL OPERATORS IN C++

C++ Logical Operator  How These Operators Work

//when statement is true print 1 and when false print 0
#include<iostream>
using namespace std;
int main()
{
int i = 2, j = 3, k = 4 , m = 5; 
cout << ( i == 1 ) << endl; 
cout << ( j == 3 ) << endl; 
cout << ( i >= 1 && j < 4 ) << endl; 
 cout << ( m <= 99 && k < m ) << endl; 
  cout << ( j >= i || k == m ) << endl; 
   cout << ( (k + m) < j || ( 3 - j ) >= k ) << endl;
cout << ( k + m < j || 3 - j >= k ) << endl; 
 cout << ( !m ) << endl; 
  cout << ( !(j - m) ) << endl; 
  cout << ( !( k > m) ) << endl;
system("pause");
}



0 comments:

Post a Comment