int searching()
{
cout<<"please enter firstname to search"<<endl;
string name;
cin>>name;
cin.get();
int temp;
for( int i=0; i < numberOfEmployee; i++)
{
if (name.compare(employee[i].firstname)==0)
{
cout<<"Employee found"<<endl;
printemployee (i);
temp=i;
break;
}
else
{
cout<<"Employee Not found"<<endl;
temp=-1;
}
}
return temp;
}
void saveAndQuit()
{
exit(0);
}
void print() //the program will display each of the function each at a time
{
for( int i=0; i < numberOfEmployee; i++)
{
cout<<" name of employee: " <<employee[i].firstname<<endl;
cout<<" Lastname of employee: "<<employee[i].lastname<<endl;
cout<<"contact number : "<<employee[i].contactnumber<<endl;
cout<<" Age: "<<employee[i].age<<endl;
cout<<"Salary: "<<employee[i].salary<<endl;
cout<<"Hours Worked:"<<employee[i].hoursworked<<endl;
}
}
void printemployee(int index)//
{
cout<<" name of employee: " <<employee[index].firstname<<endl;
cout<<" Lastname of employee: "<<employee[index].lastname<<endl;
cout<<"contact number : "<<employee[index].contactnumber<<endl;
cout<<" Age: "<<employee[index].age<<endl;
cout<<"Salary: "<<employee[index].salary<<endl;
cout<<"Hours of Worked:"<<employee[index].hoursworked<<endl;
}
int search(string name)
{
int temp;
for( int i=0; i < numberOfEmployee; i++)
{
if (name.compare(employee[i].firstname)==0)
{
newEmployee item; // you may have to pass these into your functions
vector<item>myVec; // unless there are in your header file
void Add()
{
cout<<"Enter employee's firstname" <<endl;
cin>> item.firstname;
cout<<"Enter employee's lastname"<<endl;
cin>>item.lastname;
cout<<"Enter employee's contact number"<<endl;
cin>>item.contactnumber;
cout<<"Enter the employee's age"<<endl;
cin>>item.age;
cout << "Enter the employee's salary" << endl;
cin >>item.salary;
cout<<"Please enter Number of Hours Worked"<<endl;
cin >>item.hoursworked;
myVec.pushback(item);
}
}
void Search()
{
string name;
cout << " Name to search? " << endl;
cin >> name;
for (int i =0; i < myVec.size(); i++)
{
if (name == myVec[i].firstName)
{
cout << " Name found " << endl;
break;
}
}
}