/ Vijos /

记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:12:33: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   12 |         tempi = atoi(com[flag+1])*atoi(com[flag-1]);
      |                                 ^
      |                                 |
      |                                 __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:528,
                 from /usr/include/c++/9/iostream:38,
                 from foo.cc:1:
/usr/include/stdlib.h:361:1: note:   initializing argument 1 of 'int atoi(const char*)'
  361 | __NTH (atoi (const char *__nptr))
      | ^~~~~
foo.cc:12:51: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   12 |         tempi = atoi(com[flag+1])*atoi(com[flag-1]);
      |                                                   ^
      |                                                   |
      |                                                   __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:528,
                 from /usr/include/c++/9/iostream:38,
                 from foo.cc:1:
/usr/include/stdlib.h:361:1: note:   initializing argument 1 of 'int atoi(const char*)'
  361 | __NTH (atoi (const char *__nptr))
      | ^~~~~
foo.cc:18:33: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   18 |         tempi = atoi(com[flag+1])+atoi(com[flag-1]);
      |                                 ^
      |                                 |
      |                                 __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:528,
                 from /usr/include/c++/9/iostream:38,
                 from foo.cc:1:
/usr/include/stdlib.h:361:1: note:   initializing argument 1 of 'int atoi(const char*)'
  361 | __NTH (atoi (const char *__nptr))
      | ^~~~~
foo.cc:18:51: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   18 |         tempi = atoi(com[flag+1])+atoi(com[flag-1]);
      |                                                   ^
      |                                                   |
      |                                                   __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/features.h:461,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/c++config.h:528,
                 from /usr/include/c++/9/iostream:38,
                 from foo.cc:1:
/usr/include/stdlib.h:361:1: note:   initializing argument 1 of 'int atoi(const char*)'
  361 | __NTH (atoi (const char *__nptr))
      | ^~~~~
foo.cc:24:25: error: expected ';' before '}' token
   24 |         cout<<com[len-4]
      |                         ^
      |                         ;
   25 |     }
      |     ~                    
foo.cc:27:25: error: expected ';' before '}' token
   27 |         cout<<com[len-3]
      |                         ^
      |                         ;
   28 |     }if(com[len-2] != '0'){
      |     ~                    
foo.cc:29:25: error: expected ';' before '}' token
   29 |         cout<<com[len-2]
      |                         ^
      |                         ;
   30 |     }
      |     ~                    
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1849 表达式求值
语言
C++
递交时间
2022-03-21 19:36:04
评测时间
2022-03-21 19:36:04
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes