Problem evenorodd
User loverin
Submission Time 2023-04-10 15:16:42
Score 0
Max Time N/A
Max Memory N/A

Compile Error

evenorodd.cpp: In function ‘int main()’:
evenorodd.cpp:7:31: error: no match for ‘operator[]’ (operand types are ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} and ‘std::__cxx11::basic_string<char>::iterator’ {aka ‘__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >’})
7 | int temp = static_cast<int>(s[s.end()]) % 2;
| ^
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/ostream:38,
from /usr/include/c++/9/iostream:39,
from evenorodd.cpp:1:
/usr/include/c++/9/bits/basic_string.h:1050:7: note: candidate: ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_