The following if-else statement will compile and run without any problems.However, it is not laid out in a way that is consistent with the other if-else statements we have used in our programs. Rewrite it so that the layout (indenting and line breaks) matches the style we used in this chapter.
if (x < 0) {x = 7; cout << "x is now positive.";} else
{x = -7; cout << "x is now negative.";}
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.