944,092 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 15988
  • C++ RSS
Jan 17th, 2006
0

Converting String to Integer help

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wigster84 is offline Offline
10 posts
since Jan 2006
Jan 17th, 2006
0

Re: Converting String to Integer help

SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005
Jan 17th, 2006
0

Re: Converting String to Integer help

Thanks so much.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
wigster84 is offline Offline
10 posts
since Jan 2006

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ Books
Next Thread in C++ Forum Timeline: Header help!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC