EasyManuals Logo
Home>IBM>Desktop>1620

IBM 1620 User Manual

IBM 1620
111 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #17 background imageLoading...
Page #17 background image
For
example, assume
the
following is
an
array
named
HRS:
38.6 1st
element
40.2
2nd
element
36.4
3rd
element
47.3 50th element
If
you
want
to refer to
the
second element
in
the
array,
the
variable
name
would
be
"HRS
( 2 )."
The
quantity
"2" is
the
subscript to
the
variable
"HRS."
(In
FORTRAN
language, subscripts
are
always enclosed in parentheses.)
the
value of HRS
(2)
is 40.2
the
value of HRS
(3)
is 36.4
the
value of HRS
(50)
is 47.3
If
you
want
to refer to
any
element of
the
array, you can
write
the
variable
name
HRs(I),
where
I may
equal
1,
2,3,
...
,
50.
As
you
can see
by
this example,
the
subscript is also a variable.
The
fact
that
a subscript can
be
a variable is ex-
tremely
important
in
FORTRAN
programming.
It
means
that
you can
set
up
a pro-
gram to
do
a basic computation, then
make
the
same computation on
many
differ-
ent
values
by
merely changing
the
value of
the
subscript. This
technique
is
de-
scribed
in
a
later
section.
So
far
we
have only considered arrays
that
are
one
dimensional, i.e.,
there
is
only one subscript for a variable.
A
1620
FORTRAN
program
may also use two-dimensional arrays.
For
example
assume
the
following is an array
named
MRATE.
Column 1 Column 2 Column
3
Row 1
14
12
8
Row 2
48
88
4
Row 3
29
25
17
Row 4
1 3
43
If
you
want
to refer to
the
quantity
in row
4,
column 2 you
would
write
the
variable
name
MRA
TE
(4,
2)
.
the
value of MRA
TE
(3,
3)
is 17
the
value of MRA
TE
(1,
2)
is 12
If
you
want
to refer to any element of
the
array, you can write
the
variable
name
MRATE
(I,
J),
where
I equals
(rows)
1,
2,
3,
or
4
and
J equals
(columns)
1,
2,
or
3.
Definition:
Example:
A subscript can
be
either
a variable or a constant,
but
must
always
be
positive
and
in
fixed
point
form.
If
v represents a variable
and
c represents a constant,
then
subscripts can
be
written
in
the
following forms.
v
c
v + c or v - c
Of
subscripts:
IRATE
J
4
NO
+3
Writing
the
1620
FORTRAN
Program 17

Other manuals for IBM 1620

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM 1620 and is the answer not in the manual?

IBM 1620 Specifications

General IconGeneral
BrandIBM
Model1620
CategoryDesktop
LanguageEnglish

Related product manuals