Hey guys, I've been stumped for a bit on this and would greatly appreciate it if someone can help me out 🙂.
Ok, let's say that there is a text file that contains the following:
123 Apples, Oranges
456 Red, Yellow
789 Email, AIM
Assume that I have correctly connected the i/o filestreams and the rest of the program is there. I just need the logic? or functions to get it working.
How do I read in only the number part of the data in the textfile? Ie. How do I sum the three numbers (123, 456, 789) while ignoring the rest of the text?
Headers to use are:
<string>
<fstream>
<iostream>
Nothing too fancy. Thanks!
EDIT: Perhaps 2 dimensional arrays are useful here?
Ok, let's say that there is a text file that contains the following:
123 Apples, Oranges
456 Red, Yellow
789 Email, AIM
Assume that I have correctly connected the i/o filestreams and the rest of the program is there. I just need the logic? or functions to get it working.
How do I read in only the number part of the data in the textfile? Ie. How do I sum the three numbers (123, 456, 789) while ignoring the rest of the text?
Headers to use are:
<string>
<fstream>
<iostream>
Nothing too fancy. Thanks!
EDIT: Perhaps 2 dimensional arrays are useful here?