In the following code, I have a 2D vector,in each index of vector each pair contains int and string. I am trying to access the each element after taking the values in the vector. Suggestions will be very much appreciated.
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,string>> aye[101];
int main()
{ int n,m,i,a,b;
string x;
cin >> n >> m;
for (int i = 1; i <= n; ++i)
{
cin >> x;
cin >> a >> b;
aye[a].push_back(make_pair(-b,x));
cout<<aye[a].first<<aye[a].second;//this is not working
cout<<aye[a][0]<<aye[a][1]<<endl;//this is not working
}
}