Tuesday, 24 February 2015

Relational Operators in C++

/*

Relational Operators
====================
< - Lessthan
<= - Lessthan or Equal To
> - Greater Than
>= - Greater Than Or Equal To
== - Equal To
!= -       Not Equal To

*/

#include<stdio.h>
#include<conio.h>
main()
{
int a=10,b=5;
clrscr();
cout<<"\n A   >   B      ="<<(a>b);
cout<<"\n A   >=  10     ="<<(a>=10);
cout<<"\n A   >   10     ="<<(a>10);
cout<<"\n A   <   B      ="<<(a<b);
cout<<"\n A   <=  10     ="<<(a<=10);
cout<<"\n A   <   10     ="<<(a<10);
cout<<"\n A   ==  10     ="<<(a==10);
cout<<"\n A   ==  5      ="<<(a==5);
cout<<"\n A   !=  5      ="<<(a!=5);
cout<<"\n A   !=  10     ="<<(a!=10);
getch();
}

No comments:

Post a Comment