0

switch for string

can someone suggest a good method to use switch for strings

5th Mar 2018, 4:09 PM
shaiju kumar
shaiju kumar - avatar
1 Answer
+ 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
5th Mar 2018, 5:08 PM
🌛DT🌜
🌛DT🌜 - avatar