String Varible of sorts

How can i have a user input a string and have the computer recognize it and make a logical operation?
Come again?
I think looking at an early post i might have figured it out.
I want to make a program where someone can enter like the word "florida" for example and it tell them about florida or any other state. I just dont know how to have them input a word and then use a switch to display the info. can Case recognize strings?
Ah. If you mean switch: it can't. You can just use if-else constructs, though.

1
2
3
4
5
6
7
string line;
getline(cin,line);
if (line=="Florida")
{
  //do something
}
else if (line=="Moon")...
wow thank you. opened up many possibilities for new programs. I appreciate it! :D
Topic archived. No new replies allowed.