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

Using C++ Declare a one-dimensional array named Totals that contains 5 elements.

ID: 3661654 • Letter: U

Question

Using C++

Declare a one-dimensional array named Totals that contains 5 elements.

Draw how a one-dimensional array named Names with 6 elements would look like in memory. Label each element with the array name and subscript. Like the array sum below. Note: I used word tables to draw my array. Click on Table – Insert - Table

Using the following array, answer questions 3 –6.

Sum(0)                  Sum(1)            Sum(2)           Sum(3) Sum(4)

100

200

300

400

450

What is the value of Sum[3]?

What is the value of Sum[3] + Sum[1]?

What is the output of the following segment of code?

    for (int x=0; x<5; x++)

    {

       cout << x << endl;

    }

What is the output of the following segment of code?

Total = 0;

   for (int x = 1; x < 5; x++)

   {

      Total = Total + Sum[x];

   }

cout << “The total is “ << Total;

100

200

300

400

450

Explanation / Answer

What is the value of Sum[3]

Answer:400

What is the value of Sum[3] + Sum[1]

Answer:600

What is the output of the following segment of code?

    for (int x=0; x<5; x++)

    {

       cout << x << endl;

    }

Answer: 0

1

2

3

4

What is the output of the following segment of code?

Total = 0;

   for (int x = 1; x < 5; x++)

   {

      Total = Total + Sum[x];

   }

cout << “The total is “ << Total;

Answer: The total is 1350

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