Record Detail

Compile Error

/in/l8.cpp: In function 'void deleteBlank(std::__cxx11::string&)':
/in/l8.cpp:17:35: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator&, std::__cxx11::basic_string<char>::iterator, char)'
     while ((i=find(i, s.end(), ' '))!=s.end())
                                   ^
In file included from /usr/include/c++/6/bits/locale_facets.h:48:0,
                 from /usr/include/c++/6/bits/basic_ios.h:37,
                 from /usr/include/c++/6/ios:44,
                 from /usr/include/c++/6/ostream:38,
                 from /usr/include/c++/6/iostream:39,
                 from /in/l8.cpp:12:
/usr/include/c++/6/bits/streambuf_iterator.h:369:5: note: candidate: template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(std::istreambuf_iterator<_CharT>, std::istreambuf_iterator<_CharT>, const _CharT2&)
     find(istreambuf_iterator<_CharT> __first,
     ^~~~
/usr/include/c++/6/bits/streambuf_iterator.h:369:5: note:   template argument deduction/substitution failed:
/in/l8.cpp:17:35: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
     while ((i=find(i, s.end(), ' '))!=s.end())
                                   ^
/in/l8.cpp: In function 'int main()':
/in/l8.cpp:39:20: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
     for (int i=0; i<s.size();i++){ //遍历字符串
                   ~^~~~~~~~~
cc1plus: all warnings being treated as errors

Information

Submit By
Type
Submission
Homework
Lab 8
Language
C++
Submit At
2018-07-30 20:12:00
Judged At
2018-07-31 01:51:41
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes