hie guys
I am creaating a program employee data base its a simple c++ program tht should allow a user to input employee details view search edit and delete......now the prblem am having is i want to creat a function that will give an employee a num when entered i am getting an error message on this line

void Employeez::setEmployNum(int en){
	empnum(0,"","",0.0);
	empnum = en;

the code for the employee template is as follows......

#include "EMPLOYEE.h"

Employeez::Employeez(int empnum,string fName, string lName, double mSalary,int wMonths)
{    
	setEmployNum(empnum);
	 setFirstname(fName);
	 setLastname(lName);
	 setMonthlySalary(mSalary);
	 setWorkMonths(wMonths);
}

Employeez::Employeez(){
	
}
Employeez::~Employeez() {
}
void Employeez::setEmployNum(int en){
	empnum(0,"","",0.0);
	empnum = en;
}
int Employeez::getEmployNum(){
	return empnum;

	}

  
void Employeez::setFirstname(string fName){
	FirstName = fName;
}
string Employeez::getFirstname(){
	return FirstName;
}

void Employeez::setLastname(string lName){
	 LastName = lName;
}
string Employeez::getLastname(){
	return LastName;
}

void Employeez::setMonthlySalary(double mSalary){
	
	if (mSalary<0)
		mSalary=0;

	MonthlySalary = mSalary;
}
double Employeez::getMonthlySalary(){
	return MonthlySalary;
}
	void Employeez::setWorkMonths(int wom){
	wMonths = wom;
}
int Employeez::getWorkMonths(){
	return wMonths;

	}



void Employeez::print() {
	cout << ": \nFirst Name: "<< getFirstname() <<endl;
	   cout << "Last Name: "<< getLastname() <<endl; 
		 cout << "Salary: " << getMonthlySalary() << endl; 
		 cout<<"Worked Months:"<<getWorkMonths()<<endl;
		   cout << "                              " << endl;
}

>>empnum(0,"","",0.0);

remove that

thanx! its now running properly..i really appreciate it.

say i want atleast one operator of my final template of the employee databse program to be overloaded which one cam i do so without affecting my programs perfomance? this is my final.cpp file

#include<iostream>

using namespace std;

#include "EmployeeDataB.h"

EmployeeDataB final;

void input () {
	int empnum, wMonths; 	string fName,lName; double mSalary;
	
	   cout << "Enter Employee's Number: ";
	       cin >> empnum;
	   cout << "Enter Employee's First Name: ";
	       cin >> fName;
	   cout << "\nEnter Employee's LastName: ";
	       cin >> lName;
	   cout << "\nEnter Employee's Monthly Salary: ";
	       cin >> mSalary;
        cout<<"\nEnter Months worked:";
		  cin>>wMonths;
			 cout<<endl;
	Employeez empz(empnum,fName,lName,mSalary,wMonths);
	final.insert(empz);
}

int main(){


	Employeez emp;
	int fl=1;
	int empnum = 0;
		while (fl!=5){
		cout << "             ***EMPLOYEE DATABASE SYSTEM***              "<<endl;
		
		  cout << "\t1) New Employee... "<<endl;
		cout << "\t2) Search Employee Deatails..."<<endl;
		cout << "\t3) Print Employee Details..."<<endl;
		cout << "\t4) Employee Deletion..."<<endl;
		cout << "\t5) Exit System..."<<endl;
		cin >> fl;

		switch(fl){
			case 1:
				input();
				break;

			case 2:
				cout << "input user number please\n";
				cin >> empnum;
				final.find(empnum);
			
				break;

			case 3:
				final.print();
				break;

			case 4:
				cout << "input user number please\n";
				cin >> empnum;
				final.remove(empnum);
				break;

			case 5:
				
				exit(0);

			default:
				
				cout<<"ERROR PLEASE ENTER APPROPRIATE DATA IN THE CORRECT DATA FIELDS..."<<endl;
		}
	}
	return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.