nord vpnnord vpn
Ad

Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.2 kB
1
Indexable
Never
#include<iostream>
using namespace std;
class student
	{
		int rno;
		public:
			void getnumber()
			{
				cout<<"Enter Roll No:";
				cin>>rno;
			}
			void putnumber()
			{
				cout<<"\n\n\t Roll no:"<<rno<<"\n";
			}
	};
	class test: virtual public student
	{
		public:
			int part1,part2;
			void getmarks()
			{
				cout<<"Enter marks\n";
				cout<<"part1:";
				cin>>part1;
				cout<<"part2:";
				cin>>part2;
			}
			
				void putmarks()
			{
				cout<<"\t marks obtained \n";
				cout<<"\n\t part1:"<<part1;
				cout<<"\n\t part2:"<<part2;
			}
	};
	class sports: public virtual student
	{
		public:
			int score;
			void getscore()
			{
				cout<<"Enter sports score:";
				cin>>score;
			}
			void putscore()
			{
				cout<<"\n\t sports score is:"<<score;
			}
	};
	class result: public test, public sports
	{
		int total;
		public:
			void display()
			{
				total = part1 + part2 +score;
				putnumber();
				putmarks();
				putscore();
				cout<<"\n\t Total score:"<<total;
			}
	};
	int main()
	{
		result obj;
		obj.getnumber();
		obj.getmarks();
		obj.getscore();
		obj.display();
	}

nord vpnnord vpn
Ad