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.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.