Converting String to Integer help

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2006
Posts: 10
Reputation: wigster84 is an unknown quantity at this point 
Solved Threads: 0
wigster84 wigster84 is offline Offline
Newbie Poster

Converting String to Integer help

 
0
  #1
Jan 17th, 2006
Hi, Im a beginner at C++...trying to learn it on my own. Im doing an exercise that i cant seem to tackle.

I have to read a set of numbers from a word file seperated by commas and convert them to integers. For example, say my set was

48909, 3453, 7739, 35
34534, 5455, 7344, 40
23423, 5345, 7089, 45
67867, 7853, 7634, 50


After this is done, i have to compare the third row of numbers(7739 7344 7089 7634) with a number given, say 7074. And see how closely related it is.

The explanation i got was that you have to convert the string to integer because thats how C++ will read it. I just need help in converting the string to integers. I want to figure out the rest....so, can anyone help me? (Would i use sprintf ??)

Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: Converting String to Integer help

 
0
  #2
Jan 17th, 2006
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 10
Reputation: wigster84 is an unknown quantity at this point 
Solved Threads: 0
wigster84 wigster84 is offline Offline
Newbie Poster

Re: Converting String to Integer help

 
0
  #3
Jan 17th, 2006
Thanks so much.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC