Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

int maino ft 10 x t 11): ft 12): system( pause\"); return 0; (a) When I compiled

ID: 3755253 • Letter: I

Question

int maino ft 10 x t 11): ft 12): system( pause"); return 0; (a) When I compiled the above code, my compiler highlighted the line marked (1) and printed the following error message: "non-Ivalue in assignment" (b) But when I changed line (1) to read: if (i 4)Il i 5)) I/ note the parentheses The program prints: C: Documents and SettingsljerryMy Documents Visual Studio 20 TRUE!TRUE!TRUE!?? Press any key to continue Ouestion Fully, and exactly explain the outputs for (a) and (b) above. In other words, what exactly is the compiler complaining about when it says: "non-Ivalue in assignment" ( last page of Hint: think operator precedence. For reference, see the precedence table on the this exam.) and why ctly does the "i f" evaluate to true in part (b) so that the program print "TRUE!!! Use the back of this page if you need more room for the answer. (10 points) The complie non-Ial Canno to Jemp

Explanation / Answer

For the first part the compiler is giving non lvalue assignment error because it must have been expecting a particular datatype value as rvalue but is getting value of some other datatype.

In the second case in the if block we have i=4 || i=5 in this case the if block resolves them as 4||5 which gives true and hence we get the following output.