Jan 5, 2010 at 7:05pm Jan 5, 2010 at 7:05pm UTC
change ' with "
' is for chars
" is for strings
Jan 5, 2010 at 7:07pm Jan 5, 2010 at 7:07pm UTC
Still doesn't work.
Last edited on Jan 5, 2010 at 7:17pm Jan 5, 2010 at 7:17pm UTC
Jan 5, 2010 at 7:18pm Jan 5, 2010 at 7:18pm UTC
Actually, you can't use switch
with strings, only with integral types.
You would have to use ifs/elses to do it.
Jan 5, 2010 at 7:19pm Jan 5, 2010 at 7:19pm UTC
switch statements require integral types.
The easy fix is to use an if/if-else/else to get that behavior. See:
http://www.cplusplus.com/doc/tutorial/control/
If you were really adamant about using the switch you could some kind of integral-type-returning hash function on Input and on your target values. That's kind of silly, though.
Last edited on Jan 5, 2010 at 7:25pm Jan 5, 2010 at 7:25pm UTC