integer m, n
real x, y
read(*,*) m, n
read(*,*) x, y
We give the input through
standard input (possibly through a data file directed to standard input). A data
file consists of records according to traditional Fortran terminology. In
our example, each record contains a number (either integer or real). Records are
separated by either blanks or commas. Hence a legal input to the program above
would be:
-1 100
-1.0 1e+2
Or, we could add commas as
separators:
-1, 100
-1.0, 1e+2
Note that Fortran 77 input is
line sensitive, so it is important to have the right number of input elements
(records) on each line. For example, if we gave the input all on one line as
-1, 100, -1.0, 1e+2
then m and n would be assigned
the values -1 and 100 respectively, but the last two values would be discarded,
leaving x and y undefined.
|