|
-
February 19th, 2009, 06:26 PM
#1
using data in a file
So I am taking an intro to programming course, and I have one problem that I haven't been able to solve. This is using the <fstream> library:
Given a text file, I need my program to use the data in it to perform certain operations. I've figured out how to read and echo the file, but I don't know how to use it to perform calculations. Example, I would like to find the average of the numbers in the lines containing 'M' (for male):
Code:
Bailey M CC 68
Harrison F CC 71
Grant M UN 75
How would I make my program get just the numeric input from the lines with an 'M', so that I can find their average?
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
|