Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:14:11: error: no match for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'std::string [1005]' {aka 'std::__cxx11::basic_string<char> [1005]'})
   14 |     cin>>n>>s;
      |     ~~~~~~^~~
      |        |    |
      |        |    std::string [1005] {aka std::__cxx11::basic_string<char> [1005]}
      |        std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}
In file included from /usr/include/c++/12/sstream:38,
                 from /usr/include/c++/12/complex:45,
                 from /usr/include/c++/12/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/12/bits/stdc++.h:54,
                 from /in/foo.cc:1:
/usr/include/c++/12/istream:168:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  168 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:168:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: warning: the address of 's' will never be NULL [-Waddress]
   14 |     cin>>n>>s;
      |             ^
/in/foo.cc:11:8: note: 's' declared here
   11 | string s[1005];
      |        ^
/in/foo.cc:14:13: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'}
   14 |     cin>>n>>s;
      |             ^
/usr/include/c++/12/istream:172:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  172 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/12/istream:172:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(short int)((std::string*)(& s))' to 'short int&'
/usr/include/c++/12/istream:175:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  175 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:175:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(short unsigned int)((std::string*)(& s))' to 'short unsigned int&'
/usr/include/c++/12/istream:179:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  179 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/12/istream:179:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(int)((std::string*)(& s))' to 'int&'
/usr/include/c++/12/istream:182:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  182 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:182:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(unsigned int)((std::string*)(& s))' to 'unsigned int&'
/usr/include/c++/12/istream:186:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  186 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:186:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(long int)((std::string*)(& s))' to 'long int&'
/usr/include/c++/12/istream:190:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  190 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:190:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(long unsigned int)((std::string*)(& s))' to 'long unsigned int&'
/usr/include/c++/12/istream:195:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  195 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:195:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(long long int)((std::string*)(& s))' to 'long long int&'
/usr/include/c++/12/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/12/istream:199:7: note:   conversion of argument 1 would be ill-formed:
/in/foo.cc:14:13: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive]
   14 |     cin>>n>>s;
      |             ^
      |             |
      |             std::string* {aka std::__cxx11::basic_string<char>*}
/in/foo.cc:14:13: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& s))' to 'long long unsigned int&'
/usr/include/c++/12/istream:235:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with

信息

递交者
类型
递交
题目
P3129 字符转换GESP202603三级T2
语言
C++
递交时间
2026-07-12 18:13:06
评测时间
2026-07-12 18:13:06
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes