12345678910111213141516171819
#include <iostream> using namespace std; int main(){ int num; cout << "Enter a number: "; cin >> num; if(num == 1){ cout << "The number is 1"; } else if(num == 2){ cout << "The number is 2"; } else{ cout << "The number is not 1 or 2"; } return 0; }
else if
if ( cond2 ) { statement2; } else { statement3; }
1234
if ( cond4 ) { statement4; } else statement5;
if ( cond4 ) { statement4; } else if ( cond2 ) { statement2; } else { statement3; }
123456789