The layout of nested if
statements is a matter of
convention. Here is another common arrangement:
#includemain ( ) { int temperature; cin >> temperature; if (temperature < 25) cout << "It is too cold!" << endl; else if (temperature > 50) cout << "It is too warm!" << endl; } --- Data --- 55 --- Result --- It is too warm!
Whatever convention you use, you should be able to defend it on the ground that you think it contributes to program clarity.