Question
Allocate storage to store a 3 row by 3 column two dimensional array of integers. Call the array A. Initial ize the array with each
Allocate storage to store a 3 row by 3 column
two dimensional
array of integers. Call the array A.
Initial
ize the array with each elements
value as follows:
A[0][0] = 1
A[0][1] = 2
A[0][2] = 3
A[1][0] = 4
A[1][1] = 5
A[1][2] = 6
A[2][0] = 7
A[2][1] = 8
A[2][2] = 9
Then, have the program use a loop to continually ask the user to
input
a
pair of integers. The first
integer is the row number
(row)
and the second integer is the column number
(column)
of an
element in the array A.
One of these three action
s will be performed depending on the value of
the row number and column number inputted:
1.
If the row number is
-
1 and
the
column number is
-
1 then terminate the loop and the
program.
2.
Or, c
heck to
m
ake sure the row number and column number are valid
indices
for the array
A
. A valid index for array A is
0
, 1 or
2
. If either
the
row
number
or
the
column
number
(
or both) are invalid then
do nothing and return to the beginning of the loop to
ask for a
new pair of numbers.
3.
If
the row number and the column number
are valid
indices
then load the value of element
A[row][column] from memory and print out the value.
Then, return to the beginning of
the loop to
ask for a new pair of numbers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started