sir we can simply write things in ""so what is the use of pair class
Where we have to use pair class
pair class is an inbuilt class to store two things in single object
suppose to want to store marks and name of student you can write
pair<string,int>p;
p.first=“name”;
p.second=marks;
Sir we can write also
Cout<<“name”<<16;
What is the difference between this and pair class
suppose this data student and it’s mark
you have to return from function how will you return ;
there are many ways but most easiest and handy is using pair
Sir how to return from fxn I don’t get plz give an example
pair<string ,int> Fucntion( parameters){
pair<string,int>ans;
now calculate ans;
return ans;
}
int main(){
pair<string,int>ans=Function(parameter);
cout<<ans.first<<" " <<ans.second<<endl;
}