Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:7:15: error: no matching function for call to 'getline(std::istream&, char [1001])'
  getline(cin,s);
               ^
In file included from /usr/include/stdio.h:935:0,
                 from /usr/include/c++/6/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:46,
                 from /in/foo.cc:1:
/usr/include/x86_64-linux-gnu/bits/stdio.h:115:1: note: candidate: __ssize_t getline(char**, size_t*, FILE*)
 getline (char **__lineptr, size_t *__n, FILE *__stream)
 ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdio.h:115:1: note:   candidate expects 3 arguments, 2 provided
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/istream:38,
                 from /usr/include/c++/6/sstream:38,
                 from /usr/include/c++/6/complex:45,
                 from /usr/include/c++/6/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5395: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>&)
     getline(basic_istream<_CharT, _Traits>&& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5395:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [1001]'
  getline(cin,s);
               ^
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/istream:38,
                 from /usr/include/c++/6/sstream:38,
                 from /usr/include/c++/6/complex:45,
                 from /usr/include/c++/6/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5388: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)
     getline(basic_istream<_CharT, _Traits>&& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5388:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [1001]'
  getline(cin,s);
               ^
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/istream:38,
                 from /usr/include/c++/6/sstream:38,
                 from /usr/include/c++/6/complex:45,
                 from /usr/include/c++/6/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.h:5380: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>&)
     getline(basic_istream<_CharT, _Traits>& __is,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.h:5380:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [1001]'
  getline(cin,s);
               ^
In file included from /usr/include/c++/6/string:53: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/istream:38,
                 from /usr/include/c++/6/sstream:38,
                 from /usr/include/c++/6/complex:45,
                 from /usr/include/c++/6/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/basic_string.tcc:1509: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)
     getline(basic_istream<_CharT, _Traits>& __in,
     ^~~~~~~
/usr/include/c++/6/bits/basic_string.tcc:1509:5: note:   template argument deduction/substitution failed:
/in/foo.cc:7:15: note:   mismatched types 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>' and 'char [1001]'
  getline(cin,s);
               ^
/in/foo.cc:8:19: error: too few arguments to function 'size_t strlen(const char*)'
  int len = strlen();
                   ^
In file included from /usr/include/c++/6/cstring:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:48,
                 from /in/foo.cc:1:
/usr/include/string.h:394:15: note: declared here
 extern size_t strlen (const char *__s)
               ^~~~~~

信息

递交者
类型
递交
题目
P1059 A4-1 回文数专题:数字之和
语言
C++
递交时间
2024-07-26 09:54:30
评测时间
2024-07-26 09:54:30
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes