All pastes #427764 Raw Edit

Unnamed

public cpp v1 · immutable
·published 2007-04-07 00:12 UTC
rendered paste body
//Jordan Steffen//stej4019//201-807//to provide employee adding//updating, and wage reporting//functionality#include <iostream>using namespace std;void menu(int &option);void add(int ids[], string names[], float wages[]);void updateName(string names[] int ids[]);	void updateWage(float wages[], int ids[]);bool search3(const int ids[], const int size, int key, int &loc);int main(){  int loc;  int option;  const int size = 100;  int ids[size];  string names[size];  float wages[size];  int choicesentinel = 1;  while(choicesentinel != 5){	  menu(option);	  if (option == 1)  {	  add(ids, names, wages);  }  if (option == 2)  {	  updateName(names, ids);  }  if (option == 3)  {	  updateWage(wages, ids);  }  if (option == 4)  {	  displayPaycheck(wages, ids);  }  if(option == 5)  {	  choicesentinel = 5;  }	  }    return 0;}void menu(int &option){  cout<<'\n'<<'\n'<<"---------------------------------"<<endl;  cout<<"| 1.) Add an Employee           |"<<endl;  cout<<"| 2.) Update an Employee Name   |"<<endl;  cout<<"| 3.) Update an Employee Wage   |"<<endl;  cout<<"| 4.) Display a Paycheck Report |"<<endl;  cout<<"| 5.) Quit                      |"<<endl;  cout<<"---------------------------------"<<endl;  cout<<"| Select an option ( 1 - 5 ) : ";  cin>>option;  cout<<"---------------------------------"<<endl;}void add(int ids[], string names[], float wages[]){		cout<<"Please enter new employee's unique ID number : ";	int idsTemp;	cin>>idsTemp;	if (search3(idsTemp)	{	cout<<"Please enter new employee's name : ";	string namesTemp;	cin>>namesTemp;	cout<<"Please enter new employee's wage : ";	float wagesTemp;	cin>>wagesTemp;	}	else	{		cout<<"This ID number already exists, please try again."<<endl;	}}void updateName(string names[], int ids[])	{	cout<<"Enter employee's ID #";	int idsTemp;	cin>>idsTemp;	if (search3(idsTemp)	{	cout<<"Employee's old name = "<<names[i]<<endl;	cout<<"Enter employee's new name : ";	string namesTemp;	cin>>namesTemp;	}	else	{		cout<<"This employee ID does not exist, please try again."<<endl;	}}void updateWage(float wages[], int ids[]){	cout<<"Enter employee's ID #";	int idsTemp;	cin>>idsTemp;	if search3(idsTemp)	{	cout<<"Employee's old wage = "<<wages[i]<<endl;	cout<<"Enter employee's new wage : ";	float wagesTemp;	cin>>wagesTemp;	}	else	{		cout<<"This employee ID does not exist, please try again."<<endl;	}}	bool search3(const int ids[], const int size, int key, int &loc){	for(loc = 0; loc < size; ++loc)	{		if(nums[loc] == key)		{			return true;		}	}	return false;}