class work

Program#1

 

#include<iostream>
#include<windows.h>
#include<cstring>
#include "untitled2.cpp"
using namespace std;
class education;
class person
{
protected:
string name;
string cnic;
string dob;
public:
void getdata()
{
cout<<"enter name";
cin>>name;
cout<<"enter cnic";
cin>>cnic;
cout<<"enter DOB";
cin>>dob;

}
void display()
{
cout<<"name= "<<name;
cout<<"cnic= "<<cnic;
cout<<"date of birth= "<<dob;
}

};

class education{
string dname;
int year;
float cgpa;
public:
void getdata()
{
cout<<"enter degree";cin>>dname;
cout<<"enter year";cin>>year;
cout<<"Cgpa";cin>>cgpa;
}
void display()
{
cout<<"\nDegree="<<dname;
cout<<"\nYear of passing ="<<year;
cout<<"\nCGPA="<<cgpa;
}
};

class employee : public person
{
string designation;
int salary;
int y_o_e;

public:
education e;
void getdata()
{person::getdata();
cout<<"enter designation";
cin>>designation;;
cout<<"enter salary";
cin>>salary;
cout<<"enter year f employeement";
cin>>y_o_e;
e.getdata();
}
void display()
{
person::display();
cout<<"\nDesignation="<<designation;
cout<<"\nSalary="<<salary;
cout<<"\nEmployment="<<y_o_e;
e.display();
}
};
int main()
{
employee e;
e.getdata();
e.display();
}

Comments

Popular posts from this blog

Stack

Operation on Single Linked List

EXTRA INFORMATION ABOUT TECHNOLOGY