cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
string and atoi
string and atoi
Aug 25, 2013 at 1:53am UTC
puppymew
(25)
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);
Aug 25, 2013 at 2:42am UTC
vlad from moscow
(6539)
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
Aug 25, 2013 at 2:51am UTC
Topic archived. No new replies allowed.