It won't take a string, You need to pass it a C style string.
so, say your string is Numbers you need to pass Numbers.c_str() to atoi
Oh, and just in case you didn't know. The string we use is a container made to hold the text. while the C style string is just a null terminated array of characters.
Your problem is that you use string but the atoi needs const char *.
int atoi ( const char * str );
You should use the c_str function of the string class. I.e:
string str;
...
int number = atoi(str.c_str());
You should check the conversion!
"Return Value
On success, the function returns the converted integral number as an int value.
If no valid conversion could be performed, a zero value is returned.
If the correct value is out of the range of representable values, INT_MAX or INT_MIN is returned."
Please read this. Consider some of the other alternatives before using atoi. If you are already using std::string why not use streams to get the job done? http://cplusplus.com/forum/articles/9645/