Hello ladies and gents,
Wondered if any of you could help me out here, I'm trying to increment an element of a vector of integers. Here's the code:
#include <algorithm>
#include <cctype>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<int> scores;
scores.push_back(500);
scores.push_back(600);
scores.push_back(300);
vector<int>::iterator iter;
for (iter = scores.begin(); iter != scores.end(); ++iter)
cout << *iter << endl;
for (iter = scores.begin(); iter != scores.end(); ++iter)
???????? // what do I put here
for (iter = scores.begin(); iter != scores.end(); ++iter)
cout << *iter << endl;
cout << "Press enter to exit.\n";;
cin.ignore(cin.rdbuf()->in_avail() + 1);
return 0;
}
My idea is to increment the scores by 1 so that the values are:
501
601
301
How can I do that?
Any help would be appreciated :D