can we write this in C++ switch ?

Posted by jellly on Stack Overflow See other posts from Stack Overflow or by jellly
Published on 2011-01-16T12:44:56Z Indexed on 2011/01/16 12:53 UTC
Read the original article Hit count: 169

Filed under:
|
#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 ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about switch