C++ examples for Statement:if
Read an integer and check its value in if statement
#include <iostream> using namespace std; int main()//from w w w. ja v a2 s . c om { int num; cout << "Enter a number: "; cin >> num; if (num == 5) cout << "Bingo!\n"; else cout << "Bongo!\n"; return 0; }