- #1
ineedhelpnow
- 651
- 0
im going through previous assignments to study for a test and i can't seem to remember how i did this one.
Add each element in origList with the corresponding value in offsetAmount. Print each sum followed by a space. Ex: If origList = {40, 50, 60, 70} and offsetAmount = {5, 7, 3, 0}, print:
45 57 63 70
Sample program:
(Wondering)
Add each element in origList with the corresponding value in offsetAmount. Print each sum followed by a space. Ex: If origList = {40, 50, 60, 70} and offsetAmount = {5, 7, 3, 0}, print:
45 57 63 70
Sample program:
Code:
#include <iostream>
#include <vector>
using namespace std;
int main() {
const int NUM_VALS = 4;
vector<int> origList(NUM_VALS);
vector<int> offsetAmount(NUM_VALS);
int i = 0;
origList.at(0) = 40;
origList.at(1) = 50;
origList.at(2) = 60;
origList.at(3) = 70;
offsetAmount.at(0) = 5;
offsetAmount.at(1) = 7;
offsetAmount.at(2) = 3;
offsetAmount.at(3) = 0;
<STUDENT CODE>
cout << endl;
return 0;
}
(Wondering)