Array piece entered by user

I am trying to expand the following program to allow users to enter an employee ID (part of an array) so they can get information (wage, how much above max, how much above min) about that certain employee. This information is also in wages. Can anyone help with this?

Note: I do not need help really on this code and how it is written currently, but only how to expand it. Thanks

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

# include <iostream>
using namespace std;



void getHours (long EmpID [],int Hours [], int size){
	int i;
	
	for (i=0; i<size; i++){
		cout<<"Employee"<<" "<< EmpID [i]<< "hours:"; 
		cin >> Hours [i]; 
		
		while (Hours [i] < 0){
			cout<<"Invalid"<<endl;
			cout<<"Employee"<<" "<< EmpID [i] <<"hours:";
			cin >>Hours [i]; 
		}
	}
}

void getPayRate (long EmpID [], float PayRate [], int size) {
	int i;

	for (i=0; i<size; i++){
		cout<<"Employee"<<" "<< EmpID [i]<< "pay rate:"; 
		cin >> PayRate [i]; 

		while (PayRate[i] < 6.00){
			cout<<"Invalid"<<endl;
			cout<<"Employeed"<<" "<<EmpID [i] <<"pay rate:"; 
			cin>> PayRate [i];
		}
	}
}

void getWages (long EmpID[], int Hours[], float PayRate[],float Wages [], int size){
	int i;
	
	for (i=0; i<size; i++)
		Wages[i] = Hours [i] * PayRate [i];
}

void SelectionSort (long EmpID[], float ar [], int size) {
	int x, minIndex, minValue;
	
	for (x = 0; x < (size - 1); x++){
		minIndex = x;
		minValue = ar [x];
		
		for (int index = x + 1; index < size; index++){
			if (ar [index] < minValue){
				minValue = ar[index];
				minIndex = index;
			}
		}
		ar[minIndex] = ar[x];
		ar[x] = minValue; 
	}
}


int main () {
	int amount = 7;
	int x;
	long EmpID[ ]={5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 7580489};
	int Hours [7]; 
	float PayRate [7];
	float Wages [7];

	getHours (EmpID, Hours, amount);
	getPayRate (EmpID, PayRate, amount);
	getWages (EmpID,Hours,PayRate,Wages,amount);

	SelectionSort(EmpID, Wages, amount);

	for (x=0; x < amount; x++)
		cout<<"Employee"<<" "<< EmpID [x]<< "your total is" << Wages [x]<<endl;

	return 0;
}
Topic archived. No new replies allowed.