i have written down the code but it is showing error . can you see towards it and tell me the correct solution.
Question of Sort game
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
#include
#include
using namespace std;
bool mycompare(pair<string,int> p1,pair<string,int> p2){
if(p1.second==p2.second){
return p1.first < p2.first;
}
return p1.second > p2.second;
}
int main(){
int minsalary,n;
pair<string,int> emp[10000005];
cin>>minsalary;
cin>>n;
string name;
int salary;
for (int i=0;i<n;i++){
cin>>name>>salary;
emp[i].first = name;
emp[i].second = salary;
}
sort(emp,emp+n,mycompare);
for (int i=0;i<n;i++){
if(emp[i].second=>minsalary){
cout<<emp[i].first<<" "<<emp[i].second<<endl;
}
}
return 0;
}
@goel43101
Please send your code on CB IDE
And also mention the error that you faced
Your code seems fine at a quick go