string and atoi

How do I use string and atoi at the same time?

string scroes;
char input[SIZE];

cout<<" Enter your score" << endl;
cin.getline (input, SIZE);
scores = atoi (input);
As it follows from the name of function atoi it converts an object of type char[] (alpha) to type int. Class std::string is not the type int. So the compiler shall issue an error for this statement

scores = atoi (input);
Last edited on
Topic archived. No new replies allowed.