So I was asked to solve this question...however when i compile it, it doesn't work...could somebody tell me what's wrong and how to solve it (im guessing it's something to do with overloading since my lecturer was talking abt it just before this was given)? thanks a lot!
#include <iostream>
#include <vector>
using namespace std;
class Integer {
public:
int value;
};
int main() {
vector<Integer> v;
for( int i=0; i<10; i++ ) {
Integer x;
x.value = i;
v.push_back( x );
}
vector<Integer>::iterator itr;
for( itr=v.begin(); itr!=v.end(); itr+=2 )
cout << *itr << endl;
return 0;
}