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
Get step-by-step solutions from verified subject matter experts
