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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading and working on data file

Status
Not open for further replies.

WSUPhys

Technical User
Feb 6, 2013
20
US
Fortran I have a .dat file that I am trying to extract the information from in order to calculate the average miles per gallon and the sigma of the distribution.

The file has lines with the structure
19990122 88888 30.5

The first word is a date in yyyymmdd format, second word is odometer reading, third word is amount of fuel used to fill the tank.

I know that I need to take the mileage from a subsequent line, subtract the mileage from the preceding line and then divide that answer by the amount of fuel to get the mpg but I am unsure how to do this. Any suggestions would be appreciated.


so far-

Program mpg
Integer i,j,k
open (unit = 1, file = "car.dat" )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top