can we write this in C++ switch ?
- by jellly
#include <iostream>
using namespace std;
int main(){
char i;
cin >>i;
switch (i){
case ('e'||'i'||'o'||'u'||'a'):
cout<<"Vowel";
break;
case ('+'||'-'||'/'||'*'||'%'):
cout<<"Op";
break;
}
return 0;
}
if not than how can we use comparison or logical operators in switch ?
& why cant we declare and initialize variable in single case without using scope ?