How do you convert a string to an int? In my book under string functions, it shows this short example:
ia = atoi ("-123.45xyz");
which says that ia = 123.
So, I tried applying this to my code.
index = atoi (a.GetCode()); cout<<description[index]; //a.GetCode() returns a number string 0 - 9 //description is an array that holds the job descriptions to the corresponding code
I included the <cstdlib> like the book says but i get this error message when I compiled it with the "CC" compiler:
Error: Could not find a match for std::atoi(std::basic_string<char, std::char_traits<char>, std::allocator<char>>)
what does this mean? how do i fix it? is there any other way to convert to an int?