Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:9:9: error: case label ''+'' not within a switch statement
    9 |         case '+':cout<<a<<"+"<<b<<"="<<a+b;break;
      |         ^~~~
/in/foo.cc:9:44: error: break statement not within loop or switch
    9 |         case '+':cout<<a<<"+"<<b<<"="<<a+b;break;
      |                                            ^~~~~
/in/foo.cc:10:9: error: case label ''-'' not within a switch statement
   10 |         case '-':cout<<a<<"-"<<b<<"="<<a-b;break;
      |         ^~~~
/in/foo.cc:10:44: error: break statement not within loop or switch
   10 |         case '-':cout<<a<<"-"<<b<<"="<<a-b;break;
      |                                            ^~~~~
/in/foo.cc:11:9: error: case label ''*'' not within a switch statement
   11 |         case '*':cout<<a<<"*"<<b<<"="<<a*b;break;
      |         ^~~~
/in/foo.cc:11:44: error: break statement not within loop or switch
   11 |         case '*':cout<<a<<"*"<<b<<"="<<a*b;break;
      |                                            ^~~~~
/in/foo.cc:12:9: error: case label ''/'' not within a switch statement
   12 |         case '/':(a%b==0)?cout<<a<<"/"<<b<<"="<<a/b:cout<<a<<"/"<<b<<"="<<a/b<<"..."<<a%b;break;
      |         ^~~~
/in/foo.cc:12:91: error: break statement not within loop or switch
   12 |         case '/':(a%b==0)?cout<<a<<"/"<<b<<"="<<a/b:cout<<a<<"/"<<b<<"="<<a/b<<"..."<<a%b;break;
      |                                                                                           ^~~~~
/in/foo.cc:13:9: error: case label not within a switch statement
   13 |         default:cout<<"Invalid operator";
      |         ^~~~~~~

信息

递交者
类型
递交
题目
P1720 简单计算器
语言
C++
递交时间
2025-04-16 21:48:37
评测时间
2025-04-16 21:48:37
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes