How to input a sentence and display an output based on your sentence?

Suppose I wanted to answer a question like this in a sentence


cout<<" What did you do today? \n\n";


how would i do that? How could be able to input a sentence with spaces.
and then if my sentence includes the word "hockey" (or something), i'd ask it a different question.

Could you explain or just write a brief program showing this (that last one would be REALLY helpful)

Thanks
|
Last edited on
Do not post the same topic multiple times.

For your question, you can use getline(cin, str) to get the input into a string, then look through the string for any words you want.
Topic archived. No new replies allowed.