Problems with case 'p' || 'P': syntax within a switch statement in C++
问题 I've used the switch statement the following way: switch (ch){ case 'P' || 'p': goto balance; break; case 'r' || 'R': goto menu; break; default: cout<<"\t\tInvalid Choice!!"<<endl; system ("\t\tpause"); system ("cls"); goto menu; break; } But it seems there's something wrong with the following syntax: case 'r' || 'R' Compiler complains about "duplicate case value". What's wrong with my code? 回答1: Change it to case 'P': case 'p': goto balance; break; Using goto is usually not a good idea. In