记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:8:17: error: conflicting declaration 'std::vector<std::__cxx11::basic_string<char> > s'
    8 |  vector<string> s;
      |                 ^
foo.cc:6:9: note: previous declaration as 'std::string s'
    6 |  string s;
      |         ^
foo.cc:11:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |  for (int i = 0; i < s.length(); i++)
      |                  ~~^~~~~~~~~~~~
foo.cc:15:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for (int i = 0; i < s.length() - 1; i++)
      |                  ~~^~~~~~~~~~~~~~~~
foo.cc:33:20: error: cannot convert 'const std::__cxx11::basic_string<char>' to 'char'
   33 |    s.push_back(it->first);
      |                ~~~~^~~~~
      |                    |
      |                    const std::__cxx11::basic_string<char>
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from foo.cc:1:
/usr/include/c++/9/bits/basic_string.h:1353:24: note:   initializing argument 1 of 'void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::push_back(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
 1353 |       push_back(_CharT __c)
      |                 ~~~~~~~^~~
foo.cc:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i = 0; i < s.length(); i++)
      |                  ~~^~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

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