1->atoi signature is this:
int atoi ( const char * str );
2-> read some more threads here to find out alternatives to atoi. You should avoid using it.
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
Hmmm.. don't know where to start from. First things first, 'num' is of type 'char', do you have a class 'char' which has a fn c_str defined? No. Its a fn of the 'string' class. Then you didn't even read my earlier post properly.
I guess you need to read up the chapters on the 'data types' a couple of times over. Read about int,char,double etc. Then read about arrays, chars and pointers. And then about the 'string' class. And then come back to this problem again.
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
Why don't you post the problem statement first. Then explain how you are trying to achieve it in your code. Then as I said, read about data-types. how did you find out about c_str fn? And I posted the correct function signature for atoi in my post above, does it have 2 parameters? Did you even read that?
Agni
Practically a Master Poster
655 posts since Dec 2007
Reputation Points: 431
Solved Threads: 116
i think that using stringstream might work.
All sorts of things would work. If it were me, I'd read in the whole line with getline, then parse it. Delimiters would be commas and dashes, after you extracted the first letter.
VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711