IGNOU, SMU and KSOU Bsc solved assignments – C++ Program to MultiLevel Inheritance.

IGNOU, SMU and KSOU Bsc solved assignments – C++ Program to MultiLevel Inheritance.

If you are BSc IT, Btech C/S, MCA or Msc computer science or Bsc computer science students and looking for solved assignments on C++ here is proper solution.

Below MultiLevel Inheritance. It is solved assignment for IGNOU, SMU and KSOU Bsc IT or Computer science students and MCA students.

 

// MultiLevel Inheritance.

 

#include<iostream.h>

#include<conio.h>

 

class Student

{

protected : int rno;

char name[10];

 

public : void getdata()

{

cout<<” Roll Number : “;

cin>>rno;

cout<<” Name : “;

cin>>name;

}

};

 

class Marks : public Student

{

protected : int s1,s2,s3;

 

public : void getmks()

{

cout<<” Enter 3 Subject marks : “;

cin>>s1>>s2>>s3;

}

 

void putdata()

{

cout<<”\n Roll Number : “<<rno;

cout<<”\n Name        : “<<name;

cout<<”\n Three Subject Marks :”;

cout<<”\n C++         : “<<s1;

cout<<”\n Data Strut  : “<<s2;

cout<<”\n Comp Org    : “<<s3;

}

};

 

class Result : public Marks

{

private : int tot;

float avg;

 

public:                  void cal()

{

tot=s1+s2+s3;

avg=tot/3.0;

}

void putresult()

{

cout<<”\n Total is : “<<tot;

cout<<”\n Percentage is : “<<avg;

}

};

 

void main()

{

clrscr();

 

Result r;

 

r.getdata();

r.getmks();

r.putdata();

r.cal();

r.putresult();

 

getch();

}

All New Updates

Leave a Reply

Your email address will not be published. Required fields are marked *

Security Code: