I am working on a program that calculates the area, and circumference of a circle. It reads the radius from a file. I can get it to read the file, process the information, and print to another file. The issue i have is it is only doing this for the last number in the list. It is supposed to read the file and process every number until the list is completed.
I think it is a very simple mistake i am making, but after 6 hours of trying to figure it out im spent.
This program has been modified by ###########
Radius Area Circumference
123.5 47877.7 775.7
123.5 47877.7 775.7
123.5 47877.7 775.7
123.5 47877.7 775.7
123.5 47877.7 775.7
123.5 47877.7 775.7
The loop on line 34 gets the circumference and area OK, but it doesn't do anything with it.
Note that each time the loop runs and you re-calculate the area and circumference... you are dropping the old value (variables can only hold 1 value at a time -- so when you calculate the area for the 2nd circle, you lose the area of the 1st circle).
Then on the loop on line 41 -- you're printing the same area/circumference over and over (the last one processed, which was the 6th circle)
Since you don't need to do anything with the area/circ other than print it, I would simply get rid of that line 41 loop and print the data directly from the line 34 loop. That way you print each circle as it's computed, so it doesn't matter that you don't remember each circle's area/circ.