Question: Consider the following main function: // echo machine #include #include using namespace std; int main () { string str; while (str == goodbye) { cout
Consider the following main function:
// echo machine #include#include using namespace std; int main () { string str; while (str == "goodbye") { cout << "Enter a word: "; cin >> str; cout << "You entered: " << str << ' '; } }
What is wrong with this function?
| A. The loop condition contains a syntax error. The exclamation point is not allowed in a condition statement. |
| B. The loop condition will not be false, so the loop will never execute, not even once |
| C. The loop condition will not be true, so the loop will never stop executing. |
| D. The loop condition will not be true, so the loop will never execute, not even once |
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
