
C++ Syntax:
if(<condition>)
{
Statements;
.
.
.
}
Example:
If (a>b) //Check if value in a is big
{
.
.
}
If (a==b) //Check if value in a equal to value in b
{
.
.
}
if((a>b)&&(<a>20)) //Complex condition using &&
{
.
.
}
/*———————————————————————–*/
#include<iostream.h>
#include<conio.h>
void main()
{
if (10>20)
cout<<”10 is big”;
if (20>10)
cout<<”20 is big”;
getch();
}
/*—————————————————————————-*/
Output:
20 is big
See also C++ program – To check whether x is greather than y (IF statement)
Not Satisfied ? Just search & get the result
Related posts:
