Trying to understand two dimensional vector and was wondering if anyone could help me out on a sorting code for this so that it numbers 0-9 people, gets x number with each of them and then outputs the person (number) ate x pancakes - But in descending or ascending order.
/* The vector seems right if my output works,
this doesn't sort it though by person or pancake. */
vector< vector<int> > pVec(10,vector<int>(2));
for(int x=0; x < 10; x++){
pVec[x][0]= x;
}
sort(pVec[x][1].begin(), pVec[x][1].end());
for (int x = 0; x < pVec.size(); ++x)
cout << "\nPerson "<< pVec[x][0] <<" ate " << pVec[x][1]<<" pancakes.";