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

4. The following statements are equivalent (True or False): (Statement 1 (Assume

ID: 3904065 • Letter: 4

Question

4. The following statements are equivalent (True or False):

(Statement 1 (Assume variable money has been initialized):

if (money >= 10E6)

cout << "You are a millionaire." << endl;

else cout << "You are not a millionaire." << endl;

Statement 2 (Assume variable cash has been initialized):

double cash;

int money = 0;

if (cash >= 10E6)

money = 1;

switch(money)

{ case 1: cout << "You are a millionaire." << endl;

break;

default: cout << "You are not a millionaire." << endl;

break;

}

Answer (Highlight one): True False

Explanation / Answer

True , both the statements are equivalent, because in first statement if money is greater than 10E6 then it prints you are a millionaire, and in second statement we are executing the same thing using a switch statement, because if cash is greater than 10E6 then it makes money =1 and in switch if money is 1 the it prints you are a millionaire.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote