-
Notifications
You must be signed in to change notification settings - Fork 0
/
Studentprob.cpp
48 lines (46 loc) · 884 Bytes
/
Studentprob.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
#include<iostream>
#include<conio.h>
using namespace std;
class Student
{
private:
string name;
char ch;
public:
void getName()
{
cout << "Enter student's name: ";
cin >> name;
}
void studentType()
{
cout << "Enter the type of Student from the following: \n";
cout << "1. Regular Student. \n";
cout << "2. Graduate Student. \n";
ch = getche();
cout << endl;
}
void gotoClassroom()
{
if (ch == '1')
cout << "Go to your next Regular class " << name << endl;
else if (ch == '2')
cout << "Go to your next Graduate class " << name << endl;
else
cout << "Invalid Choice... " << endl;
}
};
int main()
{
int size;
cout << "Enter the total number of students to be called: ";
cin >> size;
Student a[size];
for (int i = 0; i < size; i++)
{
a[i].getName();
a[i].studentType();
a[i].gotoClassroom();
}
return 0;
}