Answer to Question #176194 in C++ for meng

Question #176194

Exercise 1

a.    Declare an array of integers scores with 4 elements.

b.    Put in the array with the follows: 20, 15, 12, 47

c.     Declare an array of string title with 4 elements.

d.    Initialize the array with the follows: “Mid1”, “Mid2”, “Final”, “total”.

e.    Print the two table of grads (score and title) using for loop.

 

The output will as the follows:-

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

Mid1 20

Mid2 15

Final 12

Total 47


1
Expert's answer
2021-03-28T23:49:38-0400
#include <iostream>

using namespace std;

int main ()
{
    int scores[] = { 20, 15, 12, 47 };
    string strings[] = { "Mid1", "Mid2", "Final", "Total" };
    for (int i = 0; i < 4; ++i)
    {
        cout << strings[i] << " " << scores[i] << "\r\n";
    }
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS