Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write C++ statements to accomplish each of the following: a) Display the value o

ID: 3734230 • Letter: W

Question

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 floatingpoint array w.

Explanation / Answer

// a
cout << a[5] << endl;

// b
cin >> b[3];

// c
int g[5];
for(int i = 0; i < 5; ++i) {
   g[i] = 8;
}

// d
float total = 0;
for(int i = 0; i < 100; ++i) {
   total += c[i];
}
cout << total << endl;

// e
for(int i = 0; i < 11; ++i) {
   b[i] = a[i];
}

// f
float smallest = w[0];
float largest = w[0];
for(int i = 0; i < 99; ++i) {
   if(w[i] > largest) {
       largest = w[i];
   }
   if(w[i] < smallest) {
       smallest = w[i];
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote