is it possible to make an array of pairs in c++?
if yes, whats the syntax?
else how to keep track of names along with their salaries?
Can i make an arrray of pairs?
YES u can
pair<string,int> arr[10]
string name ;
int salary;
for(int i = 0 ; i < 10 ; i++){
cin >> name >> salary;
a[i]= make_pair(name , salary);
}
u can take value from array using
.first & .second
like
cout << a[4].first ;
cout << a[4].second ;
will get u the name and slary of the 5th person ( 0 index based)