Simple input/output issue.

Hi guys,
I am trying to write simple question and get answer on it , but how i will identify answers if the answer contain one word which help me to write my second answer for example

cout <<"ARE YOU ACTOR, EDITOR OR CAMMERAMAN?! " << endl;

How i can identify the answer if the user used below answers.

I am Actor.
or
Actor.

so i can go for the next question based on the answer.

Thanks in advance.
closed account (o3hC5Di1)
You could use numbers that represent the options and validate those, like:

1
2
3
4
cout <<"Are you 1) an actor, 2) an editor, 3) a cameraman ? " << endl;
getline(cin, input);
stringstream(input) >> number;
if (isdigit(number)) ...


Hope that helps.

Al the best,
NwN
Last edited on
I'd have to agree with NwN's idea. The easiest way to do this would be to associate each possible choice with an integer or a char value, prompt for the input, then use the int (or char) value to determine the next step in the program.
Topic archived. No new replies allowed.