-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy 3 oop based c++ code.cpp
More file actions
47 lines (43 loc) · 1.23 KB
/
my 3 oop based c++ code.cpp
File metadata and controls
47 lines (43 loc) · 1.23 KB
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
#include<iostream>
int n;
using namespace std;
class Student{
private:
public:
int roll;
string name;
float GPA;
};
int main()
{
cout<<"PLEASE ENTER NUMBER OF STUDENT YOU WANT TO ENTER:";
cin>>n;
Student* students = new Student[n];
for(int i=0;i<n;++i)
{ cout<<"_____________________________________"<<endl;
cout<<"PLEASE ENTER THE Student Number "<<i+1<<" NAME :--"<<endl;
cout<<"Name:";
cin.ignore();
getline(cin,students[i].name);
cout<<"_____________________________________"<<endl;
cout<<"PLEASE ENTER THE Student Number "<<i+1<<" ROLL NO. :--"<<endl;
cout<<"ROLL NUMBER:";
cin>>students[i].roll;
cout<<"_____________________________________"<<endl;
cout<<"PLEASE ENTER THE Student Number "<<i+1<<" :--"<<endl;
cout<<"GPA:";
cin>>students[i].GPA;
}
cout<<"____________________________________________________"<<endl;
cout<<"DISPLAYING STUDENT DATA"<<endl;
for(int i=0;i<n;++i)
{
cout<<"STUDENT NUMBER"<<i+1<<endl;
cout<<"Name:"<<students[i].name<<endl;
cout<<"ROLL NUMBER:"<<students[i].roll<<endl;
cout<<"GPA:"<<students[i].GPA<<endl;
cout<<"____________________________________________________"<<endl;
}
delete[]students;
return 0;
}