include<conio.h>#include<iostream.h>
#include<string.h>
class student
{
char name[30];
int roll;
float m1,m2,m3,tot;
public:
student(char a[30],int b,float x,float y,float z)
{
strcpy(name,a);
roll=b;
m1=x;
m2=y;
m3=z;
}
void calculate()
{
tot=m1+m2+m3;
}
void disp()
{
cout<<"Name::"<<name<<endl
<<"Roll::"<<roll<<endl
<<"English::"<<m1<<endl
<<"Maths::"<<m2<<endl
<<"OOps::"<<m3<<endl
<<"Total::"<<tot;
}
};
void main()
{
clrscr();
int b;
char a[30];
float x,y,z;
cout<<"Enter his/her name::";
cin>>a;
cout<<"Enter his/her roll::";
cin>>b;
cout<<"Enter his English marks::";
cin>>x;
cout<<"Enter his Maths marks::";
cin>>y;
cout<<"Enter his OOps marks::";
cin>>z;
student s(a,b,x,y,z);
s.calculate();
s.disp();
getch();
}
No comments:
Post a Comment