Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Integer numValues is read from input. Then numValues integers are read and stored in vector scoresList. Write a loop that outputs each element in scoresList

Integer numValues is read from input. Then numValues integers are read and stored in vector scoresList. Write a loop that outputs each element in scoresList that is greater than 200, and assigns the element with 200. End each output with " is adjusted to 200" followed by a newline.

Ex: If the input is 3 216 197 147, then the output is:

Raw scores: 216 197 147

216 is adjusted to 200

Adjusted scores: 200 197 147

Code:

#include
#include
using namespace std;

int main() {
int numValues;
unsigned int i;
vector scoresList;

cin >> numValues;

scoresList.resize(numValues);

for (i = 0; i < scoresList.size(); ++i) {
cin >> scoresList.at(i);
}

cout << "Raw scores: ";
for (i = 0; i < scoresList.size(); ++i) {
cout << scoresList.at(i) << " ";
}
cout << endl;

/* Your code goes here */

cout << "Adjusted scores: ";
for (i = 0; i < scoresList.size(); ++i) {
cout << scoresList.at(i) << " ";
}
cout << endl;

return 0;
}

 

Step by Step Solution

3.40 Rating (150 Votes )

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_2

Step: 3

blur-text-image_3

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

Fundamentals of Financial Management

Authors: Eugene F. Brigham, Joel F. Houston

Concise 6th Edition

324664559, 978-0324664553

More Books

Students also viewed these Finance questions

Question

Subtract the polynomials. (-x+x-5) - (x-x + 5)

Answered: 1 week ago

Question

How are we on the list of controls? Where do we have deficits? P987

Answered: 1 week ago