C++ examples for Statement:if
Combine the if and else keywords to check for multiple alternatives
#include <iostream> using namespace std; int main() /*from w ww . j a v a2 s . c o m*/ { int i; cout << "Type any number: "; cin >> i; if (i > 10) { cout << "It's greater than 10." << endl; } else if (i == 10) { cout << "It's equal to 10" << endl; } else { cout << "It's less than 10." << endl; } return 0; }