-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2. Student.cpp
54 lines (52 loc) · 1010 Bytes
/
2. Student.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
#include<iostream>
using namespace std;
#define SIZE 10
class STUDENT
{
float m1,m2,m3;
char name[20],num[10];
public:
void getdata();
void dispdata();
};
void STUDENT::getdata()
{
cout<<"\nEnter student USN: " ;
cin>>name;
cout<<"Enter student name: " ;
cin>>num;
cout<<"Enter student's 3 marks: " ;
cin>>m1>>m2>>m3;
}
void STUDENT::dispdata()
{
float avg,low=m1;
if(m2<low){
low=m2;}
else if(m3<low){
low=m3;}
avg=(m1+m2+m3-low)/2;
cout<<"\nStudent USN: "<<name
<<"\nStudent name: "<<num
<<"\nStudent average: "<<avg;
}
int main()
{
STUDENT stud[SIZE];
int n,i;
cout<<"\nStudents Report";
cout<<"\nEnter the number of students: ";
cin>>n;
for(int i=0;i<n;i++){
stud[i].getdata();
}
cout<<"\n-----------------"
<<"\nStudents Details::"
<<"\n-----------------";
for( i=0;i<n;i++)
{
cout<<"\nStudent:"<<i+1;
stud[i].dispdata();
cout<<"\n------------";
}
}