Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- struct data
- {
- string username;
- int problemsSubmitted, problemsSolved;
- data()
- {
- username="";
- problemsSubmitted=0;
- problemsSolved=0;
- }
- };
- struct UVA
- {
- string nm, cntry, handle, univ;
- int solved;
- UVA()
- {
- solved=0;
- }
- };
- bool compare1(UVA l, UVA r){
- if(l.solved>r.solved)return true;
- if(l.solved==r.solved && l.nm<r.nm)return true;
- return false;
- }
- struct LIGHTOJ
- {
- string nm, cntry, handle, univ;
- int solved;
- LIGHTOJ()
- {
- solved=0;
- }
- };
- bool compare2(LIGHTOJ l, LIGHTOJ r){
- if(l.solved>r.solved)return true;
- if(l.solved==r.solved && l.nm<r.nm)return true;
- return false;
- }
- struct CODEFORCES
- {
- string nm, cntry, handle, univ;
- int solved;
- CODEFORCES()
- {
- solved=0;
- }
- };
- bool compare3(CODEFORCES l, CODEFORCES r){
- if(l.solved>r.solved)return true;
- if(l.solved==r.solved && l.nm<r.nm)return true;
- return false;
- }
- class persons
- {
- protected:
- string name;
- string countryName;
- int age;
- public:
- void setName()
- {
- cout<<"Enter Name:: ";
- cin>>name;
- }
- void setCountryName()
- {
- cout<<"Enter Country Name:: ";
- cin>>countryName;
- }
- void setAge()
- {
- cout<<"Enter Age:: ";
- cin>>age;
- }
- string getName()
- {
- return name;
- }
- string getCountryName()
- {
- return countryName;
- }
- int getAge()
- {
- return age;
- }
- };
- class students:public persons
- {
- protected:
- string institute;
- string dept;
- public:
- students()
- {
- institute="";
- dept="";
- }
- void setName()
- {
- persons::setName();
- }
- void setCountryName()
- {
- persons::setCountryName();
- }
- void setAge()
- {
- persons::setAge();
- }
- string getName()
- {
- return persons:: getName();
- }
- string getCountryName()
- {
- return persons::getCountryName();
- }
- int getAge()
- {
- return persons::getAge();
- }
- void setInstitute()
- {
- cout<<"Enter Institutions Name:: ";
- cin>>institute;
- }
- void setDept()
- {
- cout<<"Enter Department Name:: ";
- cin>>dept;
- }
- string getInstitute()
- {
- return institute;
- }
- string getDept()
- {
- return dept;
- }
- };
- class programmer:public students
- {
- private:
- data uva, lightOJ, codeforces;
- public:
- programmer()
- {
- uva.username="";
- uva.problemsSubmitted=0;
- uva.problemsSolved=0;
- lightOJ.username="";
- lightOJ.problemsSubmitted=0;
- lightOJ.problemsSolved=0;
- codeforces.username="";
- codeforces.problemsSubmitted=0;
- codeforces.problemsSolved=0;
- }
- void setName()
- {
- students::setName();
- }
- void setCountryName()
- {
- students::setCountryName();
- }
- void setAge()
- {
- students::setAge();
- }
- string getName()
- {
- return name;
- }
- string getCountryName()
- {
- return countryName;
- }
- int getAge()
- {
- return age;
- }
- void setInstitute()
- {
- students::setInstitute();
- }
- void setDept()
- {
- students::setDept();
- }
- string getInstitute()
- {
- return students::getInstitute();
- }
- string getDept()
- {
- return students::getDept();
- }
- void getUvaRecords()
- {
- cout<<"Enter UVA username: ";
- cin>>uva.username;
- cout<<"Enter Number of problems submitted: ";
- cin>>uva.problemsSubmitted;
- cout<<"Enter Number of problems solved: ";
- cin>>uva.problemsSolved;
- }
- void getLightOJRecords()
- {
- cout<<"Enter LightOJ username: ";
- cin>>lightOJ.username;
- cout<<"Enter Number of problems submitted: ";
- cin>>lightOJ.problemsSubmitted;
- cout<<"Enter Number of problems solved: ";
- cin>>lightOJ.problemsSolved;
- }
- void getCodeforcesRecords()
- {
- cout<<"Enter Codeforces username: ";
- cin>>codeforces.username;
- cout<<"Enter Number of problems submitted: ";
- cin>>codeforces.problemsSubmitted;
- cout<<"Enter Number of problems solved: ";
- cin>>codeforces.problemsSolved;
- }
- };
- class allStudents
- {
- students arrS[100];
- int numberOfStudents;
- public:
- allStudents()
- {
- numberOfStudents=0;
- }
- void getInput()
- {
- cout<<"Enter informations of student "<<++numberOfStudents<<" :"<<endl;
- arrS[numberOfStudents].setName();
- arrS[numberOfStudents].setCountryName();
- arrS[numberOfStudents].setAge();
- arrS[numberOfStudents].setInstitute();
- arrS[numberOfStudents].setDept();
- }
- void displayAllStudents()
- {
- cout<<"Informations of all students:: "<<endl<<endl;
- for(int i=1; i<=numberOfStudents; i++)
- {
- cout<<"Students Number:: "<<i<<endl;
- cout<<"Name:: "<<arrS[i].getName()<<endl;
- cout<<"Country:: "<<arrS[i].getCountryName()<<endl;
- cout<<"Age:: "<<arrS[i].getAge()<<endl;
- cout<<"Institution:: "<<arrS[i].getInstitute()<<endl;
- cout<<"Department:: "<<arrS[i].getDept()<<endl;
- }
- }
- };
- class allProgrammers
- {
- programmer arrP[100];
- UVA arrayUva[100];
- LIGHTOJ arrayLightoj[100];
- CODEFORCES arrayCodeforces[100];
- int numberOfProgrammers;
- public:
- allProgrammers()
- {
- numberOfProgrammers=0;
- }
- void getInput()
- {
- cout<<"Enter programmer number "<<++numberOfProgrammers<<" ::"<<endl<<endl;
- arrP[numberOfProgrammers].setName();
- arrP[numberOfProgrammers].setCountryName();
- arrP[numberOfProgrammers].setAge();
- arrP[numberOfProgrammers].setInstitute();
- arrP[numberOfProgrammers].setDept();
- arrP[numberOfProgrammers].getUvaRecords();
- arrP[numberOfProgrammers].getCodeforcesRecords();
- arrP[numberOfProgrammers].getLightOJRecords();
- }
- void getAllProgrammersInformation()
- {
- for(int i=1; i<=numberOfProgrammers; i++)
- cout<<"Students Number:: "<<i<<endl;
- cout<<"Name:: "<<arrP[i].getName()<<endl;
- cout<<"Country:: "<<arrP[i].getCountryName()<<endl;
- cout<<"Age:: "<<arrP[i].getAge()<<endl;
- cout<<"Institution:: "<<arrP[i].getInstitute()<<endl;
- cout<<"Department:: "<<arrP[i].getDept()<<endl;
- }
- void updateRanklist()
- {
- for(int i=1; i<=numberOfProgrammers; i++)
- {
- arrayUva[i].nm=arrP[i].getName();
- arrayUva[i].cntry=arrP[i].getCountryName();
- arrayUva[i].handle=arrP[i].uva.username;
- arrayUva[i].univ=arrP[i].getInstitute();
- arrayUva[i].solved=arrP[i].uva.problemsSolved;
- }
- sort(arrayUva+1, arrayUva+1+numberOfProgrammers);
- for(int i=1; i<=numberOfProgrammers; i++)
- {
- arrayCodeforces[i].nm=arrP[i].getName();
- arrayCodeforces[i].cntry=arrP[i].getCountryName();
- arrayCodeforces[i].handle=arrP[i].codeforces.username;
- arrayCodeforces[i].univ=arrP[i].getInstitute();
- arrayCodeforces[i].solved=arrP[i].codeforces.problemsSolved;
- }
- sort(arrayCodeforces+1, arrayCodeforces+1+numberOfProgrammers);
- for(int i=1; i<=numberOfProgrammers; i++)
- {
- arrayLightoj[i].nm=arrP[i].getName();
- arrayLightoj[i].cntry=arrP[i].getCountryName();
- arrayLightoj[i].handle=arrP[i].lightOJ.username;
- arrayLightoji].univ=arrP[i].getInstitute();
- arrayLightoj[i].solved=arrP[i].lightOJ.problemsSolved;
- }
- sort(arrayLightoj+1, arrayLightoj+1+numberOfProgrammers);
- }
- };
- int main()
- {
- allStudents s;
- allProgrammers p;
- p.getInput();
- p.displayAllStudents();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement