Im trying to create a vector of pairs, im kinda stuck here.
Code:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef pair<string, int> MyPair;
int main ()
{
vector<string> first;
vector<int> second;
vector<MyPair>::iterator it;
vector<MyPair> vPair;
const char* names[] = { "Sneezy","Dopey",
"Sleepy", "Doc",
"Happy", "Bashful", "Grumpy"
};
for (int i=0; i<7; i++) first.push_back (names[i]);
for (int i=0; i<7; i++) second.push_back (i*10);
for (int i=0; i<7; i++)
vPair.push_back(make_pair<first[i], second[i]>);
for (it=first.begin(); it!=first.end(); ++it)
cout << " " << *it;
cout << endl;
return 0;
}