C++ examples for Statement:if
Use the else keyword with if statement
#include <iostream> using namespace std; int main(){/*from w ww . java2 s .c o m*/ int i; cout << "Type any number: "; cin >> i; if (i > 10) { cout << "It's greater than 10." << endl; } else { cout << "It's not greater than 10." << endl; } return 0; }