C++ codes modifying " Introduction to arrays"

User Generated

Wbqn

Programming

Description

#include <iostream>

using namespace std;

int main()

{

int tests[6]; // array declaration

int sum = 0;

float avg;

//input test scores

cout << " Enter " << 6 << " test scores: " << endl;

for (int i = 0; i < 6; i++)

{

cout << "Enter Test " << i + 1 << ": ";

cin >> tests[i];

}

return 0;

}

------------------------------------------------------------------------------------------------------

You should do this to the codes:

1. (5 points) Type in the above program as array1.cpp. Add a comment to include your name and date. Compile and run. Draw a picture showing what the array looks like in memory.

2. (3 points) Add code to print the first test score. Add the following comment://2. Print the first test score

3. (3 points) Add code to print the last test score. Add the following comment://3. Print the last test score

4. (7 points) Add code to print all of the test scores. Add a comment: //4. Print all scores

5. (5 points) Add code to sum the test scores. Print the sum. Add a comment: //5. Sum all scores

6. (5 points) Add code to calculate and print the average test score. Add a comment: //6. Calculate the average

7. (10 points) Add code to add 10 to each test score and print all test scores. //7. Add to all elements

8. (12 points) Add code to find the highest score and display the score. //8. Calculate and display the highest score

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Your code is done. Please find the code...


Anonymous
Excellent resource! Really helped me get the gist of things.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags