Tuesday, July 14, 2009

In C++: Can a switch statement be used on strings?

No. switch statements only work on integral values or what can be considered an integral value. Which a string isn't.





Use if statements instead. Or a more complex system.

In C++: Can a switch statement be used on strings?
Nope.





The type of the switch expression must be an integral type or convertible to an integral type.

blazing star

No comments:

Post a Comment