If Statements In C++





If statements in c++
It is used to test the condition. If the given condition is true then it will execute the statement otherwise, it will execute the optional statement.

General form of simple if statement is:

If (condition)
{
Statement;
Statement;
}
Statement;

The program to find the largest of two numbers.


#include<iostream.h>
#include<conio.h>
Void main ()
{
Int a, b;
Cout<<”\n enter the value of A &B”;
Cin>>a>>b;
If (a>b)
{
Cout<<”\n a is largest”;
}
Cout<<”\n thank you”;
getch ();
}



Related posts:

  1. Manipulators In C++ Manipulators Manipulators are operators used with the insertion operator <<...
  2. Type Conversion In C++ Type Conversion In C++ This process of converting one predefined...
  3. Dekker’s Algorithm Dekker’s Algorithm Dijktra reported on algorithm for mutual exclusion for...
  4. Peterson’s algorithm Peterson’s algorithm An established algorithm known as Peterson’s algorithm provides...
  5. Predefined Data Types Predefined data types Data can be of many types (e.g....