Write C++ statements to accomplish each of the following:

a) Display the value of element 6 of character array f.
b) Input a value into element 4 of one-dimensional floating-point array b.
c) Initialize each of the 5 elements of one-dimensional integer array g to 8.
d) Total and print the elements of floating-point array c of 100 elements.
e) Copy array a into the first portion of array b. Assume double a[ 11 ], b[ 34 ];
f) Determine and print the smallest and largest values contained in 99-element floating-point array w.


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;
```

Computer Science & Information Technology

You might also like to view...

When you create an array of a class type, each element of the array is a ____________ variable.

a. reference b. global c. numeric d. Boolean

Computer Science & Information Technology

Which of the following statements is false?

a. The nodes arranged in a layout container are a combination of controls and possibly other layout containers. b. When the user interacts with a control, it generates an event. Programs can use event handling to specify what should happen when each user interaction occurs. c. An event handler is a method that responds to a user interaction. An FXML GUI’s event handlers are defined in a controller class. d. All of the above statements are true.

Computer Science & Information Technology

Functions that return true or false values are called _____.?

A. ? logical functions. B. ?statistical functions. C. ?database functions. D. ?financial functions

Computer Science & Information Technology

Explain what is meant by a query that is “grouped by” state.

What will be an ideal response?

Computer Science & Information Technology