#include<iostream.h>
void main( )
{
char name[20],subject[20];
float Basic,HRA,DA,Salary;
float calculate( )
{
return(Basic+DA+HRA);
}
public:
void Readdata( )
{
cout<<"Enter the name of Teacher:";
gets(name);
cout<<"Enter the subject:";
gets(subject);
cout<<"Enter Basic:";
cin>>Basic;
cout<<"Enter HRA:";
cin>>HRA;
cout<<"Enter DA:";
cin>>DA;
salary=calculate( );
}
void Displaydata( )
{
cout<<"Details of Teacher:"<<endl;
cout<<"-------------------"<<endl;
cout<<"Name:"<<name<<endl;
cout<<"Subject:"<<subject<<endl;
cout<<"Basic:"<<Basic<<endl;
cout<<"DA:"<<DA<<endl;
cout<<"HRA:"<<HRA<<endl;
cout<<"Salary:"<<salary<<endl;
}
};
void main( )
{
TEACHER T;
T.Readdata( );
T.Displaydata( );
}