Yes this is a homework but I have been searching for the last two days and cannot find a solution. I am trying to test these float values for exact numbers in this case since I know the data being entered. I can't get the if else if statement to produce the intended results.
Its going straight to the last else statement. I should also note that the employeeInfo[].netpay is a float and the for statement in the last else statement is transferring the array correctly. Just not the right one I'm supposed to be getting.Code:void printCheckHeader(STR30Address info, EmployeeRecord employeeInfo[],int number,FILE * reportFile) { int checkNo = 100; // disregard char Dollar[46]; char text1[46] = "Six Hundred Six and 36/100 Dollars "; char text2[46] = "Two Hundred Twenty-Three and 46/100 Dollars "; char text3[46] = "Three Hundred Twenty and 04/100 Dollars "; char text4[46] = "Five Hundred Seventy-Three and 83/100 Dollars"; char text5[46] = "Two Hundred Fourty-One and 93/100 Dollars "; printf("%f\n",employeeInfo[0].netpay); // these are printing the correct values as a test printf("%f\n",employeeInfo[1].netpay); //printing correctly for(int j = 0; j < number; j++) { if((employeeInfo[j].netpay) > 600.000000) { for(int l = 0; l < 47; l++) Dollar[l] = text1[l]; } else if((employeeInfo[j].netpay) < 225.000000) { for(int l = 0; l < 47; l++) Dollar[l] = text2[l]; } else if(((employeeInfo[j].netpay) > 315.000000) && ((employeeInfo[j].netpay) < 350.000000)) { for(int l = 0; l < 47; l++) Dollar[l] = text3[l]; } else if(((employeeInfo[j].netpay) > 500.000000) && ((employeeInfo[j].netpay) <600.000000)) { for(int l = 0; l < 47; l++) Dollar[l] = text4[l]; } else { for(int l = 0; l < 47; l++) Dollar[l] = text5[l]; }
I was hoping someone could give me some pointers as to what im doing wrong. Thank you!!