Let's analyze the following statement assuming that y is 6.
if ( y = 7 )
cout << " y is 7. How lucky of you. ";
else
cout << "y is not 7. Sorry about that.";
What will be the result of this section of code.
a. cout << "y is not 7. Sorry about that.";
b. cout << " y is 7. How lucky of you. "; //will always execute regardless of the value of y
c. y=7 is an assignment and not a comparison will not compile
d. I was texting in class and have no absolutely no idea.
e. This will compile but completely skip both statements.
Answers for C++ Course using "Starting out with C++ : from control structures through objects" by Tony Gaddis. 7/8th ed. I used the Pearson myprogramminglab to complete the homework. Here are my solutions/answers for the exercises/labs so please use the test bank as a GUIDE if you're stuck. Let me know if you find a better solution to a problem or any of the programming challenges. Thanks in advance for your support! Send in missing programming challenges to cplusplus.answers@gmail.com
Subscribe to:
Post Comments (Atom)
b. cout << " y is 7. How lucky of you. "; //will always execute regardless of the value of y
ReplyDelete