|
-
May 9th, 2009, 05:26 AM
#1
Retrieving numbers from an string.
Basically i have started learning c++. My situation is that i have an array of strings that are read from a text file, which contains lines of text which are correctly formatted.
for eg:
AC/DC,Dirty Deeds Done Dirt Cheap,303,
Alison Moyet,All Cried Out,410,
Allan Browne Quintet,Cyclosporin,291,
Now i put these in an array as i read them from the file. I want to read the numbers in the strings, these numbers are the lengths of the songs and i need to find the total length of all the songs in the file.
My prob is finding a way to get just the numbers from the string array index. Basically just the 303 from the 1st string, 410 from the 2nd string and 291 from the 3rd string. If i can do just one i can just throw it in a loop and find the total length.
I am looking for any suggestions, (i hope this is in the right forum section)
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|