/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:17:14: error: 'n' was not declared in this scope
  std::cin >> n;
              ^
/in/foo.cc:18:14: error: 'x' was not declared in this scope
  std::cin >> x;
              ^
/in/foo.cc:20:29: error: 'to_string' was not declared in this scope
    vec.push_back(to_string(i));
                             ^
/in/foo.cc:20:29: note: suggested alternatives:
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:11:
/usr/include/c++/6/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
   to_string(long double __val)
   ^~~~~~~~~
/usr/include/c++/6/bits/basic_string.h:5522:3: note:   'std::__cxx11::to_string'
/in/foo.cc:21:7: error: no match for 'operator+=' (operand types are 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}' and 'std::vector<std::__cxx11::basic_string<char> >')
   str += vec;
   ~~~~^~~~~~
In file included from /usr/include/c++/6/string:52:0,
                 from /usr/include/c++/6/bits/locale_classes.h:40,
                 from /usr/include/c++/6/bits/ios_base.h:41,
                 from /usr/include/c++/6/ios:42,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/foo.cc:11:
/usr/include/c++/6/bits/basic_string.h:1042:7: note: candidate: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       operator+=(const basic_string& __str)
       ^~~~~~~~
/usr/include/c++/6/bits/basic_string.h:1042:7: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'const std::__cxx11::basic_string<char>&'
/usr/include/c++/6/bits/basic_string.h:1051:7: note: candidate: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       operator+=(const _CharT* __s)
       ^~~~~~~~
/usr/include/c++/6/bits/basic_string.h:1051:7: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'const char*'
/usr/include/c++/6/bits/basic_string.h:1060:7: note: candidate: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       operator+=(_CharT __c)
       ^~~~~~~~
/usr/include/c++/6/bits/basic_string.h:1060:7: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'char'
/usr/include/c++/6/bits/basic_string.h:1073:7: note: candidate: std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]
       operator+=(initializer_list<_CharT> __l)
       ^~~~~~~~
/usr/include/c++/6/bits/basic_string.h:1073:7: note:   no known conversion for argument 1 from 'std::vector<std::__cxx11::basic_string<char> >' to 'std::initializer_list<char>'
/in/foo.cc:25:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < str.size(), i++){
                  ~~^~~~~~~~~~~~
/in/foo.cc:25:20: warning: value computed is not used [-Wunused-value]
/in/foo.cc:25:37: error: expected ';' before ')' token
  for (int i = 0; i < str.size(), i++){
                                     ^
/in/foo.cc:26:17: warning: comparison with string literal results in unspecified behavior [-Waddress]
   if (str[i] == "1"){
                 ^~~
/in/foo.cc:26:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

信息

递交者
类型
递交
题目
P1848 记数问题
语言
C++
递交时间
2024-08-22 15:17:44
评测时间
2024-08-22 15:17:44
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes