Why we using pair < string ,string>

why not we only use string a, string b in compare function

why not this type compare function

bool compare(string a,string b)
{

char *ptra=strtok((char *)a.c_str()," ");
char *ptrb=strtok((char *)b.c_str()," ");
int i=1;
while (i!=key)
{
    ptra=strtok(NULL," ");
    ptrb=strtok(NULL," ");
    i++;
}
//cout<<a<<" "<<b<<" , "<<ptra<<" "<<ptrb<<endl;
if (revers=="false")
{
    if(order=="numerical")
        return int(ptra)<int(ptrb);
    else
        return ptra<ptrb;
}
else
{
    if(order=="numerical")
        return int(ptra)>int(ptrb);
    else
        return ptra>ptrb;
}

}

Hello @punitsehrawat423 wee have to use pair<string,string> because while taking input you must have taken input in the pair form so you have to handle them in the form of pair only.
that is the reason.
is this the code written by you or you have written it the same from the video?

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.

hello @punitsehrawat423

u have reopend the doubt , pls let me know what issue u r facing?

pls share the complete code