C++ program – Using class to generate mark sheet using multiple inheritance

by Nideesh C on April 14, 2011 · 0 comments

in C++




#include<iostream.h>
#include<stdio.h>
#include<dos.h>
class student
{
	int roll;
	char name[25];
	char add [25];
	char *city;
	public: student()
	{
		cout<<"welcome in the student information system"<<endl;
	}
	void getdata()
	{
		cout<<"\n enter the student roll no.";
		cin>>roll;
		cout<<"\n enter the student name";
		cin>>name;
		cout<<\n enter ther student address";
		cin>>add;
		cout<<"\n enter the student city";
		cin>>city;
	}
	void putdata()
	{
		cout<,"\n the student roll no:"<<roll;
		cout<<"\n the student name:"<<name;
		cout<<"\n the student coty:"<<city;
	}
};
class mrks: public student
{
	int sub1;
	int sub2;
	int sub3;
	int per;
	public: void input()
	{
		getdata();
		cout<<"\n enter the marks1:"
		cin>>sub1:
		cout<<"\n enter the marks2:";
		cin>>sub2;
		cout<<\n enter the marks3:";
		cin>>sub3;
	}
	void output()
	{
		putdata();
		cout<<"\n marks1:"<<sub1;
		cout<<"\n marks2:"<<sub2;
		cout<<"\n marks3:"<<sub3;
	}
	void calculate ()
	{
		per= (sub1+sub2+sub3)/3;
		cout<<"\n tottal percentage"<<per;
	}
};
 
void main()
{
	marks m1[25];
	int ch;
	int count=0;
	do
	{
		cout<<\n1.input data";
		cout<<\n2.output data";
		cout<<\n3. Calculate percentage";
		cout<<\n4.exit";
		cout<<\n enter the choice";
		cin>>ch;
		switch (ch)
		{
			case 1:
			m1.input();
			count++;
			break;
 
                        case2:
			m1.output();
			break;
 
			case3:
			m1.calculate();
			break;
		}
	} while (ch!=4);
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C++ program – evaluate an expression entered in postfix form
  2. C++ program to implement Shell sort using class
  3. C++ program to implement Insertion sort using class
  4. C++ program to implement Selection sort using class
  5. C++ program to implement Quick sort Algorithm using class

Leave a Comment

Previous post:

Next post: