How do we take input in the array of pairs
I am not able to take the input in the pairthat I created
use
vector<pair<string,int>> v;
for(int i=0;i<n;i++)
{
int n1;
string s;
cin>>s>>n1;
v.push_back({s,n1});
}
@igarg145 you can do it like this -
pair<string, int> emp[100005];
string name;
int salary;
for(int i=0;i<n;i++)
{
cin>>name>>salary;
emp[i].first = name;
emp[i].second = salary;
}
if your doubt is cleared dont forget to mark it as resolved 