string and variable ?

Hello,

How can I use a string cin and associate it with a number?
what heading and variable should I chose?

example: cin >> month;
june

june = 40320

Thanks for help in advance,

Did you read the link I gave you in your previous post? Second answer down.

http://stackoverflow.com/questions/650162/why-switch-statement-cannot-be-applied-on-strings
Hello,

Simple answer: No, you can't

Have a good day.
while megatrons answer is correct, it is somewhat possible to switch on a string using a hack. in this case it is hashing the string. unfortunately i cant find my example. you can also use std::map. shamieh: please refrain from posting like that. its pointless
Topic archived. No new replies allowed.