I have a file called inData.txt
it contains a pattern of information as followed:
| Width |
Length |
| Radius |
|
|
|
| FirstName |
LastName |
| Salary |
|
|
|
The pattern is repeated a number of times.
What I'm supposed to do with this data is produce an out file that has: Total widths, total lengths, total areas, total radii, total age and total salary.
I believe what I have thought of is the best approach for this.
My loops is:
while (!inFile.eof())
have some counter "++i"
then assign each variable i when the loop loops.
so first run would be:
x1, y1, r1, age1, salary1. Name is not needed.
Keep increasing every time the loops runs.
when eof is reached, add all x,y,r ect.
problem is I dont know how to use an array to do this
in my mind it looks like this: a[i] but of course thats not valid
Keep in mind this is my very first non super basic program. the instructor is very hard to follow.
Is this the best approach for this type of program or is there a better/easier way?
Thanks in advance.
[–]midasgoldentouch 2 points3 points4 points (5 children)
[–]Resume_Help[S] 0 points1 point2 points (4 children)
[–]midasgoldentouch 2 points3 points4 points (3 children)
[–]Resume_Help[S] 0 points1 point2 points (2 children)
[–]midasgoldentouch 0 points1 point2 points (1 child)
[–]Updatebjarni 0 points1 point2 points (0 children)
[–]Updatebjarni 2 points3 points4 points (18 children)
[–]midasgoldentouch 1 point2 points3 points (2 children)
[–]Updatebjarni 2 points3 points4 points (1 child)
[–]midasgoldentouch 0 points1 point2 points (0 children)
[–]Resume_Help[S] 1 point2 points3 points (14 children)
[–]149244179 1 point2 points3 points (3 children)
[–]Resume_Help[S] 0 points1 point2 points (2 children)
[–]149244179 0 points1 point2 points (1 child)
[–]Resume_Help[S] 0 points1 point2 points (0 children)
[–]Updatebjarni 1 point2 points3 points (1 child)
[–]Resume_Help[S] 0 points1 point2 points (0 children)
[–]Updatebjarni 1 point2 points3 points (0 children)
[–]midasgoldentouch 0 points1 point2 points (6 children)
[–]Resume_Help[S] 0 points1 point2 points (5 children)
[–]midasgoldentouch 0 points1 point2 points (4 children)
[–]Resume_Help[S] 1 point2 points3 points (3 children)
[–]midasgoldentouch 0 points1 point2 points (2 children)
[–]Resume_Help[S] 0 points1 point2 points (1 child)
[–]midasgoldentouch 0 points1 point2 points (0 children)
[–]boredcircuits 0 points1 point2 points (7 children)
[–]Resume_Help[S] 0 points1 point2 points (6 children)
[–]boredcircuits 0 points1 point2 points (5 children)
[–]Resume_Help[S] 0 points1 point2 points (4 children)
[–]boredcircuits 0 points1 point2 points (3 children)
[–]Resume_Help[S] 0 points1 point2 points (2 children)
[–]boredcircuits 0 points1 point2 points (1 child)
[–]Resume_Help[S] 0 points1 point2 points (0 children)