Makefile

please tell me the code of make file for my following program....

tha Employee.cpp file is
#include "Employee.h"
Employee::Employee(){}
Employee::Employee(string nm,int a,int db,string sk,string desig,string add)
{
name=nm;
age=a;
dob=db;
skill=sk;
designation=desig;
address=add;
}


string Employee::getName()
{
cout<<"enter name";
cin>>name;
return name;
}
int Employee::getAge()
{
cout<<"enter age";
cin>>age;
return age;
}
int Employee::getDob()
{
cout<<"enter dob";
cin>>dob;
return dob;
}
string Employee::getSkill()
{
cout<<"enter skill";
cin>>skill;
return skill;
}
string Employee::getDesignation()
{
cout<<"enter designation";
cin>>designation;
return designation;
}
string Employee::getAddress()
{
cout<<"enter address";
cin>>address;
return address;
}

void Employee::setField(string nm,int a,int db,string sk,string desig,string add)
{
name=nm;
age=a;
dob=db;
skill=sk;
designation=desig;
address=add;
}
void Employee::displayEmployee()
{
cout<<"name:"<<name<<endl;
cout<<"age:"<<age<<endl;
cout<<"date of birth:"<<dob<<endl;
cout<<"skill:"<<skill<<endl;
cout<<"designation:"<<designation<<endl;
cout<<"address:"<<address<<endl;
}
int main()
{
//reading from a file
cout<<"Reading from a file"<<endl;
cout<<" "<<endl;
string eName,eSkill,eDesignation,eAddress;
int eAge,eDob;
ifstream fin("employee.txt");
if (!fin.good())
{
cout<<"File not found"<<endl;
exit(1);
}
while(!fin.eof())
{
Employee *newEmployeePtr=new Employee;
fin>>eName>>eAge>>eDob>>eSkill>>eDesignation>>eAddress;

newEmployeePtr->setField(eName,eAge,eDob,eSkill,eDesignation,eAddress);
newEmployeePtr->displayEmployee();
cout<< endl;

}

//writing into a file
Employee *newEmpPtr=new Employee;
char data[100];int num;
ofstream fout("emp.txt",ios::app);
cout<<"enter the number of records to be entered";
cin>>num;
for(int i=0;i<num;i++)
{
if (!fout.good())
{
cout<<"File not found"<<endl;
exit(1);
}
fout<<newEmpPtr->getName();
fout<<newEmpPtr->getAge();
fout<<newEmpPtr->getDob();
fout<<newEmpPtr->getSkill();
fout<<newEmpPtr->getDesignation();
fout<<newEmpPtr->getAddress();
fout<<data<<endl;
}



cout << endl;

}

and the Employee.h is
#ifndef _EMPLOYEE_H
#define _EMPLOYEE_H
#include<iostream>
#include<fstream>
class Employee
{
private:
string name;
int age;
int dob;
string skill;
string designation;
string address;
public:
Employee();
void setField(string,int,int,string,string,string);
void displayEmployee();
static int numEmployee;
string getName();
int getAge();
int getDob();
string getSkill();
string getDesignation();
string getAddress();

};
#endif


very urgent...
thanks in advance..


Last edited on
It would be really very difficult if u want to save it in a file, but instead of filing u can use DBMS(Data Base Management System) its really easy.
1
2
all:
	g++ -o NameOfExecutableFile Employee.cpp

You should put the dependency
Last edited on
Topic archived. No new replies allowed.