Question: in C++ Problem: Subtract 4 to any element's value that is greater than maxVal. Ex: If maxVal = 10, then dataPoints = {2, 12, 9,

in C++

Problem:

Subtract 4 to any element's value that is greater than maxVal.

Ex: If maxVal = 10, then dataPoints = {2, 12, 9, 20} becomes {2, 8, 9, 16}.

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

#include #include using namespace std;

int main() { int maxVal; int NUM_POINTS; unsigned int i; cin >> maxVal; cin >> NUM_POINTS; vector dataPoints(NUM_POINTS);

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

/* Your solution goes here */

for (i = 0; i < dataPoints.size(); ++i) { cout << dataPoints.at(i) << " " ; } cout << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!