Question: c++ I am trying to use switch with strings in c++, and since I found out its required to convert the strings to char I
c++
I am trying to use switch with strings in c++, and since I found out its required to convert the strings to char I have been trying to this but it does not work. I know it would be easy to use if and else if blocks but I really want to see how switch with strings would work. Would appreciate any help. thanks!
you can use this example:
string name;
cout<<"enter name:"< cin>>name; switch(name){ case ("Pai"): cout< case ("Bicho"): cout <<"animal"< deafault: cout<<"nao e familia nem animal"< }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
