Question: Integer numValues is read from input. Then numValues doubles are read and stored in vector inventoriesList. Write a loop that outputs each element in inventoriesList
Integer numValues is read from input. Then numValues doubles are read and stored in vector inventoriesList. Write a loop that outputs each element in inventoriesList that is greater than 1500.0, and assigns the element with 1500.0. End each output with ": corrected to 1500.0" followed by a newline.
Ex: If the input is 3 1366.0 2166.0 85.0, then the output is:
Raw inventories: 1366.0
2166.0 85.0 2166.0: corrected to 1500.0
Adjusted inventories: 1366.0 1500.0 85.0
#include
int main() { int numValues; unsigned int i; vector
/* Your code goes here */
cout << "Adjusted inventories: "; for (i = 0; i < inventoriesList.size(); ++i) { cout << inventoriesList.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
