#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class student {
private:
int rno,m1,m2,m3,total;
float avg;
char nm[20];
public:
void input() {
cout<<"\nEnter the Name of the Student ... :";
cin>>nm;
cout<<"Enter the Roll No... : = ";
cin>>rno;
cout<<"Enter the marks of three Subjects : ";
cin>>m1>>m2>>m3;
}
void process() {
total= m1+m2+m3;
avg= total/3.0;
}
void output() {
cout<<"\n\n\t\tThe Name of the Student "<<nm;
cout<<"\n\n\t\tThe Roll No of the Student "<<rno;
cout<<"\n\n\t\tTotal marks of the Student "<<total;
cout.precision(2);
cout<<"\n\n\t\tTotal Average of the Student "<<avg;
}
};
void main() {
student s1;
clrscr();
s1.input();
s1.process();
s1.output();
getch();
}
OUTPUT:-
Enter the Name of the Student ... :R GABA
Enter the Roll No... := 30
Enter the marks of three Subjects : 90
90
80
The Name of the Student R GABA
The Roll No of the Student 30
Total marks of the Student 260
Total Average of the Student 86.67
0 comments:
Post a Comment