0
switch for string
can someone suggest a good method to use switch for strings
1 ответ
+ 12
U can't use string in switch
i will suggest u to go for character.... instead
well u can do like this...:
if the case values have different 1st alphabet
like choices between apple , banana, mango....
switch (choices){
case 'a':
cout<<"apple";
case......
.........
........etc
}
check out this 👇
https://stackoverflow.com/questions/9856310/switch-statement-with-strings