Wednesday, September 15, 2010

Using If Else in C++ Programming

This is how you can use an if case in C++ programming.

It has syntax similar to C programming.



#include <iostream.h>
#include <conio.h>

void main()
{
int no;

cout << "Please enter a number : ";
cin >> no;
cout << endl;

if(no > 10)
cout << "Value you entered is greater than 10.";
else
cout << "Value you entered is not greater than 10.";

getch();
}

0 comments:

Post a Comment