Home > Back-end > Who can help me to see what was wrong
Who can help me to see what was wrong
Time:12-01
Thank you
CodePudding user response:
What is your expected results? Purely from the syntax Case 0 : //is followed by a colon In addition, each case if you want to do different treatment, should add break at the end of the case statement, that is, Case 0: break; Case 1: s +=1; break;//if not break, 1 case execution will continue after the case 2, of course, if your intention is case 1 and case 2 is executed, then another matter Case 2: s +=2; break; Case 3: s +=3; break; Case 4: s +=4; break;
CodePudding user response:
If write case behind the semicolon into the colon, the program can run normally,