Answer to Question #99426 in C++ for Caleb

Question #99426
Write an if-else statement that prints "Goodbye" if userString is "Quit", else prints "Hello". End with newline.
#include <iostream>
#include <string>
using namespace std;

int main() {
string userString;

cin >> userString;

/* Your solution goes here */

return 0;
}
1
Expert's answer
2019-12-02T12:16:56-0500

#include <iostream>


#include <string>


using namespace std;


int main() {


string userString;


cin >> userString;


/* Your solution goes here */

if (userString=="Quit") cout << "GoodBye!" << endl;

else cout << "Hello!" << endl;


return 0;


}


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS