Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c + + Write a for loop to print all NUM _ VALS elements of vector courseGrades, following each with a space ( including

in c++ Write a for loop to print all NUM_VALS elements of vector courseGrades, following each with a space (including the last). Print forwards, then backwards. End with newline. Ex: If courseGrades ={7,9,11,10}, print:
791110
101197
Hint: Use two for loops. Second loop starts with i = courseGrades.size()-1
#include
#include
using namespace std;
int main(){
const int NUM_VALS =4;
vector courseGrades(NUM_VALS);
int i;
for (i =0; i < courseGrades.size(); ++i){
cin >> courseGrades.at(i);
}
/* Your solution goes here */
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago