Answer the following questions regarding a two-dimensional array called table:
a) Declare the array to store int values and to have 3 rows and 3 columns. Assume that the constant variable arraySize has been defined to be 3.
b) How many elements does the array contain?
c) Use a counter-controlled for statement to initialize each element of the array to the sum of its subscripts.
d) Write a nested for statement that displays the values of each element of array table in tabular format with 3 rows and 3 columns. Each row and column should be labeled with the row or column number. Assume that the array was initialized with an initializer list containing the values from 1 through 9 in order. Show the output.
```
a) array
b) Nine.
c) for (size_t row{0}; row < table.size(); ++row) {
for (size_t column{0}; column < table[row].size(); ++column) {
table[row][column] = row + column;
}
}
d) cout << " [0] [1] [2]" << endl;
for (size_t i{0}; i < arraySize; ++i) {
cout << '[' << i << "] ";
for (size_t j{0}; j < arraySize; ++j) {
cout << setw(3) << table[i][j] << " ";
}
cout << endl;
}
```
You might also like to view...
The ________ content control enables the user to select, or not select, a specific option
Fill in the blank(s) with correct word
The Reports list in the Solver Results dialog box displays the available report types
Indicate whether the statement is true or false
Which of the following is the core of an operating system that maintains the computer's clock, starts applications, and assigns the computer's resources, such as devices, programs, apps, data, and information?
A. cell B. grid C. nexus D. kernel
Image editing software also is called illustration software.
Answer the following statement true (T) or false (F)