记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:7:22: error: conversion from 'const char*' to 'int' in a converted constant expression
    7 |                 case "+":cout<<a<<op<<b<<"="<<a+b<<break;
      |                      ^~~
foo.cc:7:22: error: could not convert '"+"' from 'const char [2]' to 'int'
    7 |                 case "+":cout<<a<<op<<b<<"="<<a+b<<break;
      |                      ^~~
      |                      |
      |                      const char [2]
foo.cc:7:52: error: expected primary-expression before 'break'
    7 |                 case "+":cout<<a<<op<<b<<"="<<a+b<<break;
      |                                                    ^~~~~
foo.cc:8:22: error: conversion from 'const char*' to 'int' in a converted constant expression
    8 |                 case "-":cout<<a<<op<<b<<"="<<a-b<<break;
      |                      ^~~
foo.cc:8:22: error: could not convert '"-"' from 'const char [2]' to 'int'
    8 |                 case "-":cout<<a<<op<<b<<"="<<a-b<<break;
      |                      ^~~
      |                      |
      |                      const char [2]
foo.cc:8:52: error: expected primary-expression before 'break'
    8 |                 case "-":cout<<a<<op<<b<<"="<<a-b<<break;
      |                                                    ^~~~~
foo.cc:9:22: error: conversion from 'const char*' to 'int' in a converted constant expression
    9 |                 case "*":cout<<a<<op<<b<<"="<<a*b<<break;
      |                      ^~~
foo.cc:9:22: error: could not convert '"*"' from 'const char [2]' to 'int'
    9 |                 case "*":cout<<a<<op<<b<<"="<<a*b<<break;
      |                      ^~~
      |                      |
      |                      const char [2]
foo.cc:9:52: error: expected primary-expression before 'break'
    9 |                 case "*":cout<<a<<op<<b<<"="<<a*b<<break;
      |                                                    ^~~~~
foo.cc:10:22: error: conversion from 'const char*' to 'int' in a converted constant expression
   10 |                 case "/":{
      |                      ^~~
foo.cc:10:22: error: could not convert '"/"' from 'const char [2]' to 'int'
   10 |                 case "/":{
      |                      ^~~
      |                      |
      |                      const char [2]
foo.cc:11:25: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   11 |                         if(b==0)
      |                         ^~
foo.cc:12:47: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   12 |                                 cout<<"error";break;
      |                                               ^~~~~
foo.cc:13:25: error: 'else' without a previous 'if'
   13 |                         else
      |                         ^~~~
foo.cc:14:38: error: conversion from 'const char*' to 'int' in a converted constant expression
   14 |                                 case "/":cout<<a<<op<<b<<"="<<a/b<<break;
      |                                      ^~~
foo.cc:14:38: error: could not convert '"/"' from 'const char [2]' to 'int'
   14 |                                 case "/":cout<<a<<op<<b<<"="<<a/b<<break;
      |                                      ^~~
      |                                      |
      |                                      const char [2]
foo.cc:14:68: error: expected primary-expression before 'break'
   14 |                                 case "/":cout<<a<<op<<b<<"="<<a/b<<break;
      |                                                                    ^~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1009 计算器
语言
C++
递交时间
2023-11-22 16:12:33
评测时间
2023-11-22 16:12:33
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes