记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:18:16: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}[int]' for array subscript
   18 |   strcpy(a[i][2],s.substr(i,2));
      |                ^
foo.cc:18:20: error: request for member 'substr' in 's', which is of non-class type 'char [100000]'
   18 |   strcpy(a[i][2],s.substr(i,2));
      |                    ^~~~~~
foo.cc:23:24: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   23 |   {if((strcmp(a[j],a[k])==0)
      |                        ^
      |                        |
      |                        __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/9/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:48,
                 from foo.cc:1:
/usr/include/string.h:137:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  137 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
foo.cc:23:24: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
   23 |   {if((strcmp(a[j],a[k])==0)
      |                        ^
      |                        |
      |                        __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/9/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:48,
                 from foo.cc:1:
/usr/include/string.h:137:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  137 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
foo.cc:23:29: error: expected ')' before '{' token
   23 |   {if((strcmp(a[j],a[k])==0)
      |      ~                      ^
      |                             )
   24 | 
   25 |    {
      |    ~                         
foo.cc:29:3: error: expected primary-expression before '}' token
   29 |   }
      |   ^
foo.cc:33:11: error: invalid types 'int[int]' for array subscript
   33 |    if (b[i]>3)
      |           ^
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
6-10 哪个字母对用得最多
比赛
2022暑期青少年社团(训练赛)
语言
C++
递交时间
2022-08-07 21:55:40
评测时间
2022-08-07 21:55:40
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes