if (condition) statement; if (condition) statement; if (condition) statement1 else statement2; if (condition) { statements A; } else { statements B; }
if (condition1) { if (condition2) { statement 1 } else { statement 2 } } else { if (condition3) { statement 3 } else { statement 4 } } if (condition 1 ) { statement 1 } else if (condition 2) { statement 2 } else if condition 3) { statement 3 } else { statement 4 }
ifstream infile; infile.open("hello.dat"); if (!infile) { cout << "Failed to open the input file hello.dat" << endl; return -1; } else { infile >> anInt; if (!infile) { cout << "Failed to read an integer from hello.dat" << endl; return -1; } return 0; }