记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:13:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   13 |     x=strlen(a);
      |              ^
      |              |
      |              std::string {aka std::__cxx11::basic_string<char>}
In file included from /nix/store/n19qjv3wanlki2nfwzr53mwc4qxk5vhn-gcc/include/c++/11.3.0/cstring:42,
                 from foo.cc:3:
/nix/store/rffag931pvbdiabwwa539wnwg1piqpx0-glibc-2.35-163-dev/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
foo.cc:14:14: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   14 |     y=strlen(b);
      |              ^
      |              |
      |              std::string {aka std::__cxx11::basic_string<char>}
In file included from /nix/store/n19qjv3wanlki2nfwzr53mwc4qxk5vhn-gcc/include/c++/11.3.0/cstring:42,
                 from foo.cc:3:
/nix/store/rffag931pvbdiabwwa539wnwg1piqpx0-glibc-2.35-163-dev/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
A8-1 字符串的输出函数
语言
C++
递交时间
2022-10-04 15:32:15
评测时间
2022-10-04 15:32:15
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes