173k views
5 votes
Write the C++ statement to declare and initialize a 5-element, one-dimensional integer array named grades. Use the following grades to initialize the array: 100 90 80 78 98. Then write the C++ code to display the contents of the array on the screen using a 'for" loop.

User Patsy Issa
by
3.5k points

1 Answer

3 votes

Answer:

int grades[5] = { 100, 90, 80, 78, 98 };

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

{

cout << grades[i];

}

User Mrudult
by
3.3k points