Problem nprime2
User Elnathan
Submission Time 2024-04-02 12:15:45
Score 0
Max Time N/A
Max Memory N/A

Compile Error

nprime2.cpp: In function ‘int main()’:
nprime2.cpp:11:29: error: no matching function for call to ‘stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)’
11 | return stoi(to_string(n)[0]);
| ^
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 nprime2.cpp:3:
/usr/include/c++/9/bits/basic_string.h:6506:3: note: candidate: ‘int std::__cxx11::stoi(const string&, std::size_t*, int)’
6506 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/9/bits/basic_string.h:6506:22: note: no known conversion for argument 1 from ‘__gnu_cxx::__all