How to use a string with a space?
Posted on 2003-03-18
I need to know how to use a string with a space.
when i typed in "Hello World"
and i do:
it only shows "Hello", but the World disappeared. How do i make it so that both words or more will be include in s?
so in the future i could use
if (s == "hello world")
Also how should i create a simple code so that when i asked the user to input a string, and any word in that string will be in the "if" statement.
for example, i asked the user to cin>>s;
if the user inputs "go to bathroom"
I want an If statement so that if any word in the string "s" contains the word "bathroom", the if statement will execute.
e.g. the user inputs "go to bathroom" or "bathroom" or "go in bathroom" , the if statement will executes.
What should the if statement look like?