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)提供评测服务