skip to main | skip to sidebar

Sunday, April 12, 2009

SINGLE INHERITANCE PROGRAM

#include
#include
class student
{
int rno;
char name[50];
char address[30];
public:
void get();
void display();
};
void student::get()
{
cout<<”enter the Student Roll Number:”; cin>> rno;
cout<<”enter the student Name :”; cin>> name;
cout<<”enter the Student Address:”; cin>> address;
}
void student::display()
{
cout<<”roll No.: “<class mark:public student
{
int mark1, mark2, mark3, mark4, mark5;
float avg;
public:
void getmark();
void displaymark();
};
void mark::getmark()
{
cout<<”enter the five subject Marks one by one”<<”\n”; cin>>mark1>>mark2>>mark3>>mark4>>mark5;
total=mark1+ mark2+ mark3+ mark4+ mark;
avg=total/5;
}
void mark::displaymarks()
{
cout<< total ="“<<" average ="“<<">Output will be

Enter the Student Roll Number: 101
Enter the student Name: Lak
Enter the Student Address: Chennai
Enter the five subject Marks one by one
80
75
80
90
100

80
75
80
90
100
Total = 425
Average = 85

No comments:

Post a Comment

[フレーム]

Subscribe to: Post Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /