Beruflich Dokumente
Kultur Dokumente
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
class COMPANY
{
char cname[20];
int nemp;
protected:
char hdoffice[80];
public:
void Input();
void Output();
};
class Branch : public COMPANY
{
char bran[20];
char badd[50];
protected:
int bno;
public:
void Enter();
void Show();
};
class EMPLOYEE : public Branch
{
char name[20];
int empno;
int noemp;
public:
void edetail();
void sdetail();
};
void COMPANY::Input()
{ cout << " Enter organisation name : ";
gets(cname);
cout << " Enter head office's address : ";
gets(hdoffice);
cout << " Enter number of employees all over the globe : ";
cin >> nemp;
}
void Branch::Enter()
{ cout << " Enter branch : ";
gets(bran);
cout << " Enter address : ";
gets(badd);
cout << " Enter branch id : ";
cin >> bno;
}
void EMPLOYEE::edetail()
{ COMPANY::Input();
Branch::Enter();
int i = 0;
cout << " Enter number of employees : ";
cin >> noemp;
}
void COMPANY::Output()
{ cout << " Company name : ";
puts(cname);
cout << " Head office's address : ";
puts(hdoffice);
cout << endl;
}
void Branch::Show()
{ cout << " Branch : ";
puts(bran);
cout << " Branch address : ";
puts(badd);
cout << " Branch number : ";
cout << bno << endl;
}
void EMPLOYEE::sdetail()
{ COMPANY::Output();
Branch::Show();
int i = 0;
cout << " No. of employees: ";
cout << noemp;
}
void main()
{ clrscr();
EMPLOYEE E;
E.edetail();
E.sdetail();
getch();
}
Output
#include <iostream.h>
#include <stdio.h>
#include <conio.h>
class COMPANY
{
char cname[50];
int nemp;
protected:
char hdoffice[80];
public:
void Input();
void Output();
};
class Branch
{
char bran[20];
char badd[50];
protected:
int bno;
public:
void Enter();
void Show();
};
class EMPLOYEE : public COMPANY, public Branch
{
int noemp;
public:
void edetail();
void sdetail();
};
void COMPANY::Input()
{
cout << " Enter company name : ";
gets(cname);
cout << " Enter head office's address : ";
gets(hdoffice);
cout << " Enter number of employees all over the globe : ";
cin >> nemp;
}
void Branch::Enter()
{
cout << " Enter branch : ";
gets(bran);
cout << " Enter address : ";
gets(badd);
cout << " Enter branch id : ";
cin >> bno;
}
void EMPLOYEE::edetail()
{
COMPANY::Input();
Branch::Enter();
cout << " Enter number of employees : ";
cin >> noemp;
}
void COMPANY::Output()
{
cout << " Company name : ";
puts(cname);
cout << " Head office's address : ";
puts(hdoffice);
cout << endl;
}
void Branch::Show()
{
cout << " Branch : ";
puts(bran);
cout << " Branch address : ";
puts(badd);
cout << " Branch number : ";
cout << bno << endl;
}
void EMPLOYEE::sdetail()
{
COMPANY::Output();
Branch::Show();
cout << " No. of employees: ";
cout << noemp;
}
void main()
{
clrscr();
EMPLOYEE E;
E.edetail();
E.sdetail();
getch();
}
Output
last = np;
}
}
void dlnode()
{
if (begn == NULL)
cout << "UNDERFLOW\n";
else
{
ptr = begn;
begn = begn->cmg;
delete ptr;
}
}
void show(list* np)
{
while (np != NULL)
{
cout << np->detail << "->";
np = np->cmg;
}
cout << "!?!\n";
}
Output
public:
void Enter();
void Show();
};
class Students : public School
{ int stno;
public:
void In();
void Out();
};
void School::Input()
{ cout << " Enter school name : ";
gets(sname);
cout << " Enter school address : ";
gets(add);
cout << " School authorise upto which class :";
cin >> ano;
}
void Teachers::Enter()
{ School::Input();
cout << " Enter number of teachers : ";
cin >> tno;
}
void Students::In()
{ School::Input();
cout << " Enter number of students : ";
cin >> stno;
}
void School::Output()
{ cout << "\n Details: \n";
cout << " School name : ";
puts(sname);
cout << " School's address : ";
puts(add);
cout << " Authorise upto class " << ano;
Output