Switch statement problem. (C++)

Started by
14 comments, last by Kalner 12 years, 2 months ago

Part of the reason you're not getting any results is that you're "choice" is an integer, use a char when you want a char.

Wouldn't 'E' or 'e' just be converted to its ASCII number equivalent automatically in this situation?

Beginner in Game Development?  Read here. And read here.

 

Advertisement
No, it would set the fail bit on the stream.
Oh.

Beginner in Game Development?  Read here. And read here.

 

Also, (and this has nothing to do with your problem but still should be done) where in the world is your
return 0;
?


There's an exemption for main. (It implicitly returns 0 unless otherwise specified.)
[TheUnbeliever]

[quote name='Alpha_ProgDes' timestamp='1329610210' post='4914359']Also, (and this has nothing to do with your problem but still should be done) where in the world is your
return 0;
?


There's an exemption for main. (It implicitly returns 0 unless otherwise specified.)
[/quote]
I know, but still.... it's just wrong not to have it.

Beginner in Game Development?  Read here. And read here.

 

Tanks for all the help =D. I love this website.

@GDNet+

I like to have no return 0; , for some reason it annoys me.
Another option is to use toupper or tolower in the switch statement...

This topic is closed to new replies.

Advertisement