Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading and writing and using format statements.

Status
Not open for further replies.

Khan12345678

Technical User
Dec 9, 2013
3
GB
Hi guys, I'm stuck on a question which i could use some help on, i tried a code but it does not work properly. I have the data below in a separate text file. The question is as follow:

In an experiment, the forces N/m2
were measured at different location. At each location there
were six readings of forces. Each force has it
s weighting factor. The experimental data were stored in following format.
F1 F2 F3 F4 F5 F6 Average
Weighting
%
20 10 30 20 15 5
Point1 52.8 57.9 45.8 41.2 46.2 76.7
Point2 45.8 57.3 41.2 43.7 47.5 55.6
Point3 3.6 35.0 20.6 28.5 14.8 73.8
Point4 29.3 57.8 32.6 13.3 57.5 61.2
Point5 64.3 53.8 69.3 41.8 57.1 53.2
Point6 45.5 50.6 63.0 47.7 46.5 56.8
Point7 67.9 48.0 56.9 52.9 18.8 47.3
Point8 63.5 41.3 45.5 64.5 57.6 63.1
Point9 68.1 41.6 53.8 45.7 34.7 43.8
Point10 6.3 63.4 55.1 62.0 18.5 42.6
Write a program to:
1.
Read the relevant data from an input file (D
ata.txt) with appropriate format statements
in the table above.
2.
Calculate the average force at each point ta
king into account the weighting factors of
various forces.
3.
Write back to the table file including th
e average force column into a new file
(results.txt) using the same
format as task one.

Thanks
 
If you want to help then post what have you done so far.
This is an help forum, not a free coding service and your question looks like a homework.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top