#include<iostream>
#include<list>
#include<algorithm>
#include<vector>


using namespace std;

class student
{
    public:
    string name;
    int roll_number;

    student(string n,int rn)
    {
        name=n;
        roll_number=rn;
    }
};
bool operator==(const student& lhs, const student& rhs)
{
    return lhs.name == rhs.name;
}


void display(list<student> &s)
{
    list<student> :: iterator p;
    for(p=s.begin();p!=s.end();p++)
    cout<<p->name<<" "<<p->roll_number<<endl;
}
int main()
{
    student s1("J",63),s2("P",29),s3("M",12),s4("S",71),s5("R",04);
    list<student> student_list;

    student_list.push_back(s1);
    student_list.push_back(s2);
    student_list.push_back(s3);
    student_list.push_back(s4);
    student_list.push_back(s5);

   display(student_list);

   list<student> :: iterator q;
   string temp;
    list<student> :: iterator s,e;
    s=student_list.begin();
    e=student_list.end();
//Accepting name of the student from the user to display roll number of it.

   cout<<"Please Enter the name of student:"<<endl;
   cin>>temp;


   q=find(s, e, student(temp, 0));

   cout<<"The number is "<<q->roll_number<<endl;
    return 0;
}
