Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <cstdlib>
- #include <ctime>
- #include <string>
- using namespace std;
- int main() {
- //didnt work as there was no pointer pointing to the value stored in the iterator.
- vector<int>::iterator iter;
- vector<int>scores;
- scores.push_back(1);
- scores.push_back(1);
- scores.push_back(1);
- scores.push_back(1);
- for (iter = scores.begin(); iter != scores.end(); ++iter)
- {
- *iter = *iter+=1;
- }
- for (iter = scores.begin(); iter != scores.end(); ++iter)
- {
- cout << *iter << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement