I have fixed it another way but I still want to know why stoi is not working here. This is the code:
#include <string>
#include<iostream>
std::string fakeBin(std::string str){
for(int i=0;i<str.size();i++){
int number=stoi(str[i]);
std::cout<<number<<std::endl;
}
return "a";
}
int main()
{
fakeBin("12354234");
return 0;
}
while compiling
int number=stoi(str[I]);
I get this error:
'stoi' was not declared in this scope
Can you explain me why I am getting this error?