Array/Function thread breakpoint... Please help!!

So Information is feeding great through my first function... Way to go first function! then I get a thread break point when the program goes to run through function: calculatePay. This would be easier if there were error messages but there aren't... I also tried to print out info after the first function and it's skipping right over those... if anyone could take a look at my code and help me debug this issue that would be greatly appreciated!!!!(I have a feeling I'm calling the function wrong...)

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

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
#include <cmath>
using namespace std;


void getEMPdata(int[], int[], double[], int);
void calculatePay (int[],double[], double[], int);


int main(int argc, const char * argv[]) {
    
    int const size = 2;
    int empID[size] = {5658845, 4520125};// 7895122, 8777542, 845277, 1302850, 7580489};
    int hours[size];
    double payrate[size];
    double wages[size];
    
    
   
    
    cout << "Please enter the hours worked by employees and their hourly pay rates.\n\n";
    
    //set numeric formatting
    cout<<fixed<<showpoint<<setprecision(2);
   
    //get employee data
    getEMPdata(empID, hours, payrate ,size);
    
    
    cout<< empID[0] << hours[0]<< payrate[0];
    cout<< empID[1] << hours[1]<< payrate[1];
    
    //calc gross pay
    
    calculatePay (hours,payrate,wages,size);
    
   

   
    
    
    return 0;
}


void getEMPdata(int ID[], int hoursin[], double pay[] ,int size){
    
    for (int i = 0; i < size; i++) {
        cout<<"Employee: "<< ID[i] <<"\n";
        cout<<"Enter Hours: ";
        cin>> hoursin[i] ;
        
        cout<<"Enter Pay: $";
        cin>> pay[i];
        
        cout<<"\n";
        
    }}

void calculatePay (int hours[],double payrate[], double wages[], int size){

   
    double overtime = 0;
    int j = 0;
    for (; j < size; j++) {
        
    if (hours[j] > 40) {
        overtime = (hours[j] - 40) * payrate[j] * 1.5;
        wages[j] = (payrate[j] * 40) + overtime;
    }
     else
      wages[j] = hours[j] * payrate[j];
        cout<<"Gross: $"<< wages[j];
   
    }

}
Last edited on
Is this the code you are using? It works for me and I cannot see any problems.
Topic archived. No new replies allowed.