-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuniversity.cpp
86 lines (82 loc) · 1.84 KB
/
university.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include<iostream>
using namespace std;
#include<string>
class student
{
protected:
string name[6];
string need;
int rollno[6],i;
float per[6];
};
class info : public student
{
public:
int accept()
{
for(i=1;i<6;i++) //accept data of 5 students
{
cout<<"Enter name of student :";
cin>>name[i];
cout<<endl<<"Enter roll no :";
cin>>rollno[i];
cout<<endl<<"Enter percentage of rollno:"<<rollno[i]<<" = ";
cin>>per[i];
cout<<endl;
}
return 0;
}
int result()
{
cout<<endl<<"Enter name of student info you want = ";
cin>>need;
for(i=1;i<6;i++)
{
if(need==name[i])
{
cout<<"Name : "<<name[i]<<endl;
cout<<"Roll no :"<<rollno[i]<<endl;
cout<<"Percentage: "<<per[i]<<endl<<endl;
}
}
cout<<"\nName is not in university database " <<endl;
return 0;
}
int display()
{
for(i=1;i<6;i++)
{
cout<<"Name : "<<name[i]<<endl;
cout<<"Roll no :"<<rollno[i]<<endl;
cout<<"Percentage: "<<per[i]<<endl<<endl;
}
return 0;
}
};
int main()
{
int a,i;
class info s;
while(true)
{
cout<<"University Management System : "<<endl;
cout<<"1. Add student "<<endl;
cout<<"2. Display students "<<endl;
cout<<"3. Search student by name "<<endl;
cout<<"4. Quit "<<endl;
cout<<"Enter your choice : ";
cin>>a;
switch(a){
case 1 : s.accept();
break;
case 2 : s.display();
break;
case 3 : s.result();
break;
case 4 : return 0;
break;
default: cout<<"Invalid choice . Please try again "<<endl;
}
}
return 0;
}