0
how can we use cin>> in switch to enter a value that can match with the case
2 Antworten
0
A switch statement can't use strings as input. The best alternative is to use multiple if statements.
another option is to link words to numbers and use these numbers as input instead of the word itself.
0
for ex:
void main()
{ int x;
cin>>x;
switch(x)
{ case 1:
cout<<"……";
break;
…
…
case n:
cout<<"……";
break;}