#include<iostream>
#include<conio.h>
using namespace std;
class student
{
int rno; //roll number
int s1,s2,s3,s; //nt marks s1,s2,s3
char name;
int total;
float percentage; //percentage
public:
void getData() //implicit fuction
{
cout<<"\n Entar the student roll number:";
cin>>rno;
cout<<"\n Enter the student name:";
cin>>name;
cout<<"\n Entar the marks of three subjects";
cin>>s1>>s2>>s3;
cout<<endl;
}
void calculate()
{
total=s1+s2+s3;
percentage=total/3;
}
void display()
{
cout<<"Roll no:"<<rno<<endl;
cout<<"name:"<<name<<endl;
cout<<"total marks:"<<total<<endl;
cout<<"percentage:"<<percentage;
}
};
int main()
{
student s;
s.getData();
s.calculate();
s.display();
getch();
}
No comments:
Post a Comment