PROGRAM TEMPS ************************************************************************ * Program illustrating the use of nested implied DO loops to read and * * print the elements of a two-dimensional array. Identifiers used are: * * TEMTAB : two-dimensional array of temperatures * * MAXTIM : parameter specifying maximum # of times * * MAXLOC : parameter specifying maximum # of locations * * NTIMES : # of times temperatures are recorded * * NLOCS : # of locations at which temperatures are recorded * * TIME : row subscript for the table * * LOC : column subscript for the table * * * * Input: NTIMES, NLOCS, and elements of TEMTAB * * Output: The array TEMTAB in table format * ************************************************************************ INTEGER MAXTIM, MAXLOC, NTIMES, NLOCS, TIME, LOC PARAMETER (MAXTIM = 24, MAXLOC = 10) REAL TEMTAB(MAXTIM,MAXLOC) PRINT *, 'ENTER # OF TIMES TEMPERATURES ARE RECORDED' PRINT *, 'AND # OF LOCATIONS WHERE RECORDED:' READ *, NTIMES, NLOCS PRINT *, 'ENTER THE TEMPERATURES AT THE FIRST LOCATION,' PRINT *, 'THEN THOSE AT THE SECOND LOCATION, AND SO ON:' READ *, ((TEMTAB(TIME,LOC), LOC = 1, NLOCS), TIME = 1, NTIMES) PRINT * PRINT 100, (LOC, LOC = 1, NLOCS) 100 FORMAT(1X, T13, 'LOCATION' / 1X, 'TIME', 10I6) DO 130 TIME = 1, NTIMES PRINT 110, TIME, (TEMTAB(TIME,LOC), LOC = 1, NLOCS) 110 FORMAT(/1X, I3, 2X, 10F6.1/) 130 CONTINUE END