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

Answer the questions that follow given these lines of code. string str1, str2; c

ID: 1797129 • Letter: A

Question

Answer the questions that follow given these lines of code.

string str1, str2;

cin >> str1 >> str2;
if(str1 == str2)
{
cout << str1 << " == " << str2 << endl;
}
else if (str1 > str2)
{
cout << str1 << " > " << str2 << endl;
}
else
{
cout << str1 << " < " str2 << endl;
}

a. What do these lines output if the input is "diamond diamond"?

b. What do these lines output if the input is "diamond gold"?

c. What do these lines output if the input is "silver gold"?

Explanation / Answer

a) diamond == diamond b) diamond gold
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