Solution to Write a c++ program that takes your name from keyboard and display the following if … - Sikademy
Author Image

Archangel Macsika

Write a c++ program that takes your name from keyboard and display the following if your name has 10 character your name is too long if it comprise between 5 and 9 character your name is medium if it comprise less than 5 character your name is too Short

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question


#include <iostream> #include <string> using namespace std; int main() { string name; do { cout << "\nPlease, enter your name (q - exit program): "; cin >> name; if (name != "q") { if (name.size() == 10) cout << "Your name is too Long"; else if (name.size() >= 5 && name.size() <= 9) cout << "Your name is Medium"; else if (name.size()<5) cout << "Your name is too Short"; } } while (name != "q"); }

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-44-sqid-1026-qpid-22