记录详情

Compile Error

foo.cc: In function 'void FindMax(std::string&)':
foo.cc:14:18: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]' (did you forget the '()' ?)
   14 |  for(int i=0;i<s.size;i++)
      |                ~~^~~~
      |                      ()
foo.cc:17:19: error: no matching function for call to 'std::__cxx11::basic_string<char>::find(int, std::string&)'
   17 |   if(s.find(i+1,ss)!=-1)continue;
      |                   ^
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:9:
/usr/include/c++/9/bits/basic_string.h:2351:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 2351 |       find(const _CharT* __s, size_type __pos, size_type __n) const
      |       ^~~~
/usr/include/c++/9/bits/basic_string.h:2351:7: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/9/bits/basic_string.h:2365:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 2365 |       find(const basic_string& __str, size_type __pos = 0) const
      |       ^~~~
/usr/include/c++/9/bits/basic_string.h:2365:32: note:   no known conversion for argument 1 from 'int' to 'const std::__cxx11::basic_string<char>&'
 2365 |       find(const basic_string& __str, size_type __pos = 0) const
      |            ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/9/bits/basic_string.h:2397:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(const _CharT*, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 2397 |       find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
      |       ^~~~
/usr/include/c++/9/bits/basic_string.h:2397:41: note:   no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 2397 |       find(const _CharT* __s, size_type __pos = 0) const _GLIBCXX_NOEXCEPT
      |                               ~~~~~~~~~~^~~~~~~~~
/usr/include/c++/9/bits/basic_string.h:2414:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(_CharT, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type = long unsigned int]'
 2414 |       find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
      |       ^~~~
/usr/include/c++/9/bits/basic_string.h:2414:34: note:   no known conversion for argument 2 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
 2414 |       find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
      |                        ~~~~~~~~~~^~~~~~~~~
foo.cc: In function 'int main()':
foo.cc:25:11: error: no matching function for call to 'getline(std::string&)'
   25 |  getline(s);
      |           ^
In file included from /usr/include/stdio.h:864,
                 from /usr/include/c++/9/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:46,
                 from foo.cc:9:
/usr/include/x86_64-linux-gnu/bits/stdio.h:118:1: note: candidate: '__ssize_t getline(char**, size_t*, FILE*)'
  118 | getline (char **__lineptr, size_t *__n, FILE *__stream)
      | ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio.h:118:1: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/9/string:56,
                 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:9:
/usr/include/c++/9/bits/basic_string.tcc:1538:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 1538 |     getline(basic_istream<_CharT, _Traits>& __in,
      |     ^~~~~~~
/usr/include/c++/9/bits/basic_string.tcc:1538:5: note:   template argument deduction/substitution failed:
foo.cc:25:11: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   25 |  getline(s);
      |           ^
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:9:
/usr/include/c++/9/bits/basic_string.h:6459:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6459 |     getline(basic_istream<_CharT, _Traits>& __is,
      |     ^~~~~~~
/usr/include/c++/9/bits/basic_string.h:6459:5: note:   template argument deduction/substitution failed:
foo.cc:25:11: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   25 |  getline(s);
      |           ^
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:9:
/usr/include/c++/9/bits/basic_string.h:6467:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)'
 6467 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/9/bits/basic_string.h:6467:5: note:   template argument deduction/substitution failed:
foo.cc:25:11: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   25 |  getline(s);
      |           ^
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:9:
/usr/include/c++/9/bits/basic_string.h:6474:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::getline(std::basic_istream<_CharT, _Traits>&&, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&)'
 6474 |     getline(basic_istream<_CharT, _Traits>&& __is,
      |     ^~~~~~~
/usr/include/c++/9/bits/basic_string.h:6474:5: note:   template argument deduction/substitution failed:
foo.cc:25:11: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
   25 |  getline(s);
      |           ^
foo.cc:26:4: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'tolower'
   26 |  s.tolower();
      |    ^~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

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