Consider a 2-by-3 integer array t.
a) Write a declaration for t.
b) How many rows does t have?
c) How many columns does t have?
d) How many elements does t have?
e) Write the names of all the elements in row 1 of t.
f) Write the names of all the elements in column 2 of t.
g) Write a single statement that sets the element of t in the first row and second column 2 to zero.
h) Write a series of statements that initialize each element of t to zero. Do not use a loop.
i) Write a nested for statement that initializes each element of t to zero.
j) Write a statement that inputs the values for the elements of t from the keyboard.
k) Write a series of statements that determine and print the smallest value in array t.
l) Write a statement that displays the elements in row 0 of t.
a) ```
cout << f[ 6 ] << '\n';
```
b) ```
cin >> b[ 4 ];
```
c) ```
int g[ 5 ] = { 8, 8, 8, 8, 8 };
or int g[ 5 ];
for ( int j = 0; j < 5; j++ )
g[ j ] = 8;
```
d) ```
total = 0.0;
for ( int k = 0; k < 100; k++ )
{
total += c[ k ]; // assume total declared and initalized
cout << c[ k ] << '\n';
} // end for
```
e) ```
for ( int i = 0; i < 11; i++ )
b[ i ] = a[ i ];
```
f) ```
smallest = w[ 0 ];
largest = w[ 0 ];
// assume all variables declared and initialized
for ( int j = 1; j < 99; j++ )
{
if ( w[ j ] < smallest )
smallest = w[ j ];
else if ( w[ j ] > largest )
largest = w[ j ];
} // end for
cout << smallest << ' ' << largest;
```
You might also like to view...
Which of the following exists in the form of a single circuit board?
A. rack server B. tower server C. blade server D. bay server
What is another term for vector graphics software?
A. Drawing software B. Photo editing software C. Digital compositing D. All of the above
Prolog and other declarative languages were classified as fifth-generation languages.?
Answer the following statement true (T) or false (F)
Channels have many of the same properties as ________________.
Fill in the blank(s) with the appropriate word(s).