#include<iostream>
using namespace std;
class Student
{
private:
double rollno;
public:
void setroll(int a);
int showroll();
Student():rollno(0)
{
}
Student(int a):rollno(a)
{
}
void search_roll();
};
void Student::setroll(int a)
{
rollno=a;
}
int Student::showroll()
{
return rollno;
}
void Student:: search_roll()
{
int r;
Student d;
cout<<"Enter Roll No :";
cin>>r;
d.setroll(r);
switch(r)
{
case 1:
{
cout<<"==========================================n";
cout<<"nRoll number of student :1 ";
cout<<"nName of student :Mobeenn";
cout<<"nMarks in Physics :60/100n
";
cout<<"nMarks in Chemistry :70/100n ";
cout<<"nMarks in Maths : 80/100n";
cout<<"nMarks in English :85/100n ";
cout<<"nMarks in Computer Science :65/100n";
cout<<"nPercentage of student is : 72%n";
cout<<"nGrade of student is :Bn";
cout<<"==========================================n";
break;
}
case 2:
{
cout<<"==========================================n";
cout<<"nRoll number of student :2 ";
cout<<"nName of student :Kashifn";
cout<<"nMarks in Physics :70/100n ";
cout<<"nMarks in Chemistry :80/100n ";
cout<<"nMarks in Maths :90/100n";
cout<<"nMarks in English :76/100n ";
cout<<"nMarks in Computer Science :57/100n";
cout<<"nPercentage of student is :74%n";
cout<<"nGrade of student is :Bn";
cout<<"==========================================n";
break;
}
case 3:
{
cout<<"==========================================n";
cout<<"nRoll number of student :3 ";
cout<<"nName of student :Qamarn";
cout<<"nMarks in Physics :75/100n
";
cout<<"nMarks in Chemistry :85/100n ";
cout<<"nMarks in Maths :72/100n";
cout<<"nMarks in English :76/100n ";
cout<<"nMarks in Computer Science :87/100n";
cout<<"nPercentage of student is : 79%n";
cout<<"nGrade of student is :Bn";
cout<<"==========================================n";
break;
}
case 4:
{
cout<<"==========================================n";
cout<<"nRoll number of student :4 ";
cout<<"nName of student :Alin";
cout<<"nMarks in Physics :80/100n ";
cout<<"nMarks in Chemistry :52/100n ";
cout<<"nMarks in Maths :48/100n";
cout<<"nMarks in English :35/100n ";
cout<<"nMarks in Computer Science :78/100n";
cout<<"nPercentage of student is : 59%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 5:
{
cout<<"==========================================n";
cout<<"nRoll number of student :5 ";
cout<<"nName of student :Husnain Alin";
cout<<"nMarks in Physics :70/100n ";
cout<<"nMarks in Chemistry :52/100n ";
cout<<"nMarks in Maths :58/100n";
cout<<"nMarks in English :75/100n ";
cout<<"nMarks in Computer Science :78/100n";
cout<<"nPercentage of student is :66%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 6:
{
cout<<"==========================================n";
cout<<"nRoll number of student :6 ";
cout<<"nName of student :Adnan alin";
cout<<"nMarks in Physics :50/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 62%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 7:
{
cout<<"==========================================n";
cout<<"nRoll number of student :7 ";
cout<<"nName of student :Mohsin Alin";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :88/100n ";
cout<<"nMarks in Computer Science :79/100n";
cout<<"nPercentage of student is :71%n";
cout<<"nGrade of student is :Bn";
cout<<"==========================================n";
break;
}
case 8:
{
cout<<"==========================================n";
cout<<"nRoll number of student :8 ";
cout<<"nName of student :Hamza Alin";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 9:
{
cout<<"==========================================n";
cout<<"nRoll number of student :9 ";
cout<<"nName of student :Hamza Farooqn";
cout<<"nMarks in Physics :56/100n ";
cout<<"nMarks in Chemistry :75/100n ";
cout<<"nMarks in Maths :85/100n";
cout<<"nMarks in English :56/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 69%n";
cout<<"nGrade of student is :Bn";
cout<<"==========================================n";
break;
}
case 10:
{
cout<<"==========================================n";
cout<<"nRoll number of student :9 ";
cout<<"nName of student :Hassan Alin";
cout<<"nMarks in Physics :59/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :85/100n ";
cout<<"nMarks in Computer Science :35/100n";
cout<<"nPercentage of student is : 60%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 20:
{
cout<<"==========================================n";
cout<<"nRoll number of student :20 ";
cout<<"nName of student :Junaid Alin";
cout<<"nMarks in Physics :56/100n ";
cout<<"nMarks in Chemistry :75/100n ";
cout<<"nMarks in Maths :35/100n";
cout<<"nMarks in English :95/100n ";
cout<<"nMarks in Computer Science :85/100n";
cout<<"nPercentage of student is : 69%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 11:
{
cout<<"==========================================n";
cout<<"nRoll number of student :11 ";
cout<<"nName of student :Salman Ahmad Alin";
cout<<"nMarks in Physics :45/100n ";
cout<<"nMarks in Chemistry :35/100n ";
cout<<"nMarks in Maths :71/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :45/100n";
cout<<"nPercentage of student is : 52%n";
cout<<"nGrade of student is :Dn";
cout<<"==========================================n";
break;
}
case 12:
{
cout<<"==========================================n";
cout<<"nRoll number of student :12 ";
cout<<"nName of student :Abdulwahab n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 13:
{
cout<<"==========================================n";
cout<<"nRoll number of student :13 ";
cout<<"nName of student :Aslam Ali n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 14:
{
cout<<"==========================================n";
cout<<"nRoll number of student :14 ";
cout<<"nName of student :Mudassir Ali n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 15:
{
cout<<"==========================================n";
cout<<"nRoll number of student :15 ";
cout<<"nName of student :Anas Rafique n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 16:
{
cout<<"==========================================n";
cout<<"nRoll number of student :16 ";
cout<<"nName of student :Zain Ali n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 19:
{
cout<<"==========================================n";
cout<<"nRoll number of student :19 ";
cout<<"nName of student :Sohail Ahmad n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 17:
{
cout<<"==========================================n";
cout<<"nRoll number of student :17 ";
cout<<"nName of student :Dawood Hameed n";
cout<<"nMarks in Physics :75/100n ";
cout<<"nMarks in Chemistry :35/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :15/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 18:
{
cout<<"==========================================n";
cout<<"nRoll number of student :19 ";
cout<<"nName of student :Ahmad Ali n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
default:
{
cout<<"Invalid Roll number Try again";
}
}
}
int main()
{
Student a;
a.search_roll();
return 0;
}
case 17:
{
cout<<"==========================================n";
cout<<"nRoll number of student :17 ";
cout<<"nName of student :Dawood Hameed n";
cout<<"nMarks in Physics :75/100n ";
cout<<"nMarks in Chemistry :35/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :15/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
case 18:
{
cout<<"==========================================n";
cout<<"nRoll number of student :19 ";
cout<<"nName of student :Ahmad Ali n";
cout<<"nMarks in Physics :66/100n ";
cout<<"nMarks in Chemistry :45/100n ";
cout<<"nMarks in Maths :75/100n";
cout<<"nMarks in English :65/100n ";
cout<<"nMarks in Computer Science :75/100n";
cout<<"nPercentage of student is : 65%n";
cout<<"nGrade of student is :Cn";
cout<<"==========================================n";
break;
}
default:
{
cout<<"Invalid Roll number Try again";
}
}
}
int main()
{
Student a;
a.search_roll();
return 0;
}

Student search by roll no project in c++

  • 1.
    #include<iostream> using namespace std; classStudent { private: double rollno; public: void setroll(int a); int showroll(); Student():rollno(0) { } Student(int a):rollno(a) { } void search_roll(); }; void Student::setroll(int a) { rollno=a; } int Student::showroll() { return rollno; } void Student:: search_roll() { int r; Student d; cout<<"Enter Roll No :"; cin>>r; d.setroll(r); switch(r) { case 1: { cout<<"==========================================n"; cout<<"nRoll number of student :1 "; cout<<"nName of student :Mobeenn"; cout<<"nMarks in Physics :60/100n "; cout<<"nMarks in Chemistry :70/100n "; cout<<"nMarks in Maths : 80/100n"; cout<<"nMarks in English :85/100n "; cout<<"nMarks in Computer Science :65/100n"; cout<<"nPercentage of student is : 72%n"; cout<<"nGrade of student is :Bn"; cout<<"==========================================n"; break; } case 2: { cout<<"==========================================n";
  • 2.
    cout<<"nRoll number ofstudent :2 "; cout<<"nName of student :Kashifn"; cout<<"nMarks in Physics :70/100n "; cout<<"nMarks in Chemistry :80/100n "; cout<<"nMarks in Maths :90/100n"; cout<<"nMarks in English :76/100n "; cout<<"nMarks in Computer Science :57/100n"; cout<<"nPercentage of student is :74%n"; cout<<"nGrade of student is :Bn"; cout<<"==========================================n"; break; } case 3: { cout<<"==========================================n"; cout<<"nRoll number of student :3 "; cout<<"nName of student :Qamarn"; cout<<"nMarks in Physics :75/100n "; cout<<"nMarks in Chemistry :85/100n "; cout<<"nMarks in Maths :72/100n"; cout<<"nMarks in English :76/100n "; cout<<"nMarks in Computer Science :87/100n"; cout<<"nPercentage of student is : 79%n"; cout<<"nGrade of student is :Bn"; cout<<"==========================================n"; break; } case 4: { cout<<"==========================================n"; cout<<"nRoll number of student :4 "; cout<<"nName of student :Alin"; cout<<"nMarks in Physics :80/100n "; cout<<"nMarks in Chemistry :52/100n "; cout<<"nMarks in Maths :48/100n"; cout<<"nMarks in English :35/100n "; cout<<"nMarks in Computer Science :78/100n"; cout<<"nPercentage of student is : 59%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 5: { cout<<"==========================================n"; cout<<"nRoll number of student :5 "; cout<<"nName of student :Husnain Alin"; cout<<"nMarks in Physics :70/100n "; cout<<"nMarks in Chemistry :52/100n "; cout<<"nMarks in Maths :58/100n"; cout<<"nMarks in English :75/100n "; cout<<"nMarks in Computer Science :78/100n"; cout<<"nPercentage of student is :66%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 6: { cout<<"==========================================n";
  • 3.
    cout<<"nRoll number ofstudent :6 "; cout<<"nName of student :Adnan alin"; cout<<"nMarks in Physics :50/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 62%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 7: { cout<<"==========================================n"; cout<<"nRoll number of student :7 "; cout<<"nName of student :Mohsin Alin"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :88/100n "; cout<<"nMarks in Computer Science :79/100n"; cout<<"nPercentage of student is :71%n"; cout<<"nGrade of student is :Bn"; cout<<"==========================================n"; break; } case 8: { cout<<"==========================================n"; cout<<"nRoll number of student :8 "; cout<<"nName of student :Hamza Alin"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 9: { cout<<"==========================================n"; cout<<"nRoll number of student :9 "; cout<<"nName of student :Hamza Farooqn"; cout<<"nMarks in Physics :56/100n "; cout<<"nMarks in Chemistry :75/100n "; cout<<"nMarks in Maths :85/100n"; cout<<"nMarks in English :56/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 69%n"; cout<<"nGrade of student is :Bn"; cout<<"==========================================n"; break; } case 10: { cout<<"==========================================n"; cout<<"nRoll number of student :9 "; cout<<"nName of student :Hassan Alin"; cout<<"nMarks in Physics :59/100n "; cout<<"nMarks in Chemistry :45/100n ";
  • 4.
    cout<<"nMarks in Maths:75/100n"; cout<<"nMarks in English :85/100n "; cout<<"nMarks in Computer Science :35/100n"; cout<<"nPercentage of student is : 60%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 20: { cout<<"==========================================n"; cout<<"nRoll number of student :20 "; cout<<"nName of student :Junaid Alin"; cout<<"nMarks in Physics :56/100n "; cout<<"nMarks in Chemistry :75/100n "; cout<<"nMarks in Maths :35/100n"; cout<<"nMarks in English :95/100n "; cout<<"nMarks in Computer Science :85/100n"; cout<<"nPercentage of student is : 69%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 11: { cout<<"==========================================n"; cout<<"nRoll number of student :11 "; cout<<"nName of student :Salman Ahmad Alin"; cout<<"nMarks in Physics :45/100n "; cout<<"nMarks in Chemistry :35/100n "; cout<<"nMarks in Maths :71/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :45/100n"; cout<<"nPercentage of student is : 52%n"; cout<<"nGrade of student is :Dn"; cout<<"==========================================n"; break; } case 12: { cout<<"==========================================n"; cout<<"nRoll number of student :12 "; cout<<"nName of student :Abdulwahab n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 13: { cout<<"==========================================n"; cout<<"nRoll number of student :13 "; cout<<"nName of student :Aslam Ali n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n";
  • 5.
    cout<<"nGrade of studentis :Cn"; cout<<"==========================================n"; break; } case 14: { cout<<"==========================================n"; cout<<"nRoll number of student :14 "; cout<<"nName of student :Mudassir Ali n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 15: { cout<<"==========================================n"; cout<<"nRoll number of student :15 "; cout<<"nName of student :Anas Rafique n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 16: { cout<<"==========================================n"; cout<<"nRoll number of student :16 "; cout<<"nName of student :Zain Ali n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 19: { cout<<"==========================================n"; cout<<"nRoll number of student :19 "; cout<<"nName of student :Sohail Ahmad n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; }
  • 6.
    case 17: { cout<<"==========================================n"; cout<<"nRoll numberof student :17 "; cout<<"nName of student :Dawood Hameed n"; cout<<"nMarks in Physics :75/100n "; cout<<"nMarks in Chemistry :35/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :15/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 18: { cout<<"==========================================n"; cout<<"nRoll number of student :19 "; cout<<"nName of student :Ahmad Ali n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } default: { cout<<"Invalid Roll number Try again"; } } } int main() { Student a; a.search_roll(); return 0; }
  • 7.
    case 17: { cout<<"==========================================n"; cout<<"nRoll numberof student :17 "; cout<<"nName of student :Dawood Hameed n"; cout<<"nMarks in Physics :75/100n "; cout<<"nMarks in Chemistry :35/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :15/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } case 18: { cout<<"==========================================n"; cout<<"nRoll number of student :19 "; cout<<"nName of student :Ahmad Ali n"; cout<<"nMarks in Physics :66/100n "; cout<<"nMarks in Chemistry :45/100n "; cout<<"nMarks in Maths :75/100n"; cout<<"nMarks in English :65/100n "; cout<<"nMarks in Computer Science :75/100n"; cout<<"nPercentage of student is : 65%n"; cout<<"nGrade of student is :Cn"; cout<<"==========================================n"; break; } default: { cout<<"Invalid Roll number Try again"; } } } int main() { Student a; a.search_roll(); return 0; }