Answer the questions that follow given these lines of code: string str1, str2; c
ID: 3627916 • 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
please rate - thanks
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"? diamond==diamond
b. What do these lines output if the input is "diamond gold"? diamond<gold
c. What do these lines output if the input is "silver gold"? silver>gold
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.