0
Can we use such conditions in switch statements?
int y; cin>>y; switch (y) { case 1||2||3|| : cout<<"great"; break; default: cout<<"oh no!"; } đ€đ€
2 Answers
+ 2
Place the case in sequential lines as follows:
int y;
cin >> y;
switch (y)
{
case 1:
case 2:
case 3:
cout << "great";
break;
default:
cout << "oh no!";
}
+ 1
Nope!