+ 1

Why I can only use switch statements in C++ only for intergers?

5th Jun 2020, 8:13 AM
Purple Requiem
Purple Requiem - avatar
4 Réponses
+ 8
You can use them for every primitive datatype.
5th Jun 2020, 8:14 AM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
sorry you can't proof that (╯°□°)╯︵ ┻━┻ the switch accepts cases of the same type, look 👇. switch (8) {} // where 8 is integer you can only use integers as cases switch ("8") {} // where 8 is string you can only use strings as cases
5th Jun 2020, 8:22 AM
Ahlin Chan
Ahlin Chan - avatar
+ 1
Switch is used for all primative data types.
5th Jun 2020, 2:02 PM
Naveed
Naveed - avatar