PROGRAM Table_of_Temperatures !----------------------------------------------------------------------- ! Program illustrating i/o of a two-dimensional array. Variables ! used are ! Temperature : two-dimensional array of temperatures ! NumTimes : number of times temperatures are recorded ! NumLocs : number of locations at which temperatures ! are recorded ! Time : row subscript for the table ! Location : column subscript for the table ! ! Input: NumTimes, NumLocs, and elements of Temperature ! Output: The array Temperature in table format !----------------------------------------------------------------------- IMPLICIT NONE REAL, DIMENSION(:, :), ALLOCATABLE :: Temperature INTEGER :: NumTimes, NumLocs, Time, Location PRINT *, "Enter number of times temperatures are recorded" PRINT *, "and number of locations where recorded:" READ *, NumTimes, NumLocs ALLOCATE (Temperature(NumTimes, NumLocs)) PRINT *, "Enter the temperatures at the first location," PRINT *, "then those at the second location, and so on:" READ *, ((Temperature(Time, Location), & Location = 1, NumLocs), Time = 1, NumTimes) PRINT * PRINT '(1X, T13, "Location" / 1X, "Time", 10I6)', & (Location, Location = 1, NumLocs) DO Time = 1, NumTimes PRINT '(/1X, I3, 2X, 10F6.1/)', & Time, (Temperature(Time, Location), Location = 1, NumLocs) END DO DEALLOCATE (Temperature) END PROGRAM Table_of_Temperatures