OK, I got rid of 8 more errors, something stupid I was missing but the errors didn't say anything that led me right I just stumbled in to it. The rest though I'm completely lost on. ----- Original Message ----- From: "John Miller" <n1umj@xxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx> Sent: Tuesday, October 30, 2007 5:22 PM Subject: one more try on C programming help
OK, I've worked on this, changed it some and get nowhere. Yes, I did try to compile it and out of 29 errors, I was able to make sense out of 1, which fixed 4 of them but the rest are absolutely no good to me what so ever. I'm sick of looking at it, and for this week's assignment this has to be 100%. I know if I stick with it alone, that will never happen so if Anyone can offer anything on this constructive I would really appreciate it. I'm getting nowhere. If I see 1 more error telling me I'm missing something that's actually there, there will be no more computer to do this on after I'm done with the hammer.(start code) #include <stdio.h> /* function prototypes */ void initData(emp, SIZE); float calculateOverTime(int entry, float *wagePtr,float *hoursWorkedPtr); float calculateGrossPay(int entry, float *wagePtr,float *hoursWorkedPtr);void displayEntry(int entry, int *clockNumberPtr,float *wagePtr,float *hoursWorkedPtr);struct emp; int main (char *argv, int argc) { /*get clock info*/ int clockNumber; /*employee number*/ float wage; /* declare wage */ float hoursWorked; /*enter hours worked*/ int i=0;//index for for loop initData(clockNumber,wage,hoursWorked); for (i=0;i<5;i++) getHoursWorked(i,clockNumber,hoursWorked); printf("Clock #\tWAge\thours\tOver time\tGross Pay\n"); for (i=0;i<5;i++) displayEntry(i,clockNumber,wage,hoursWorked); struct emp myempArray[5]; return(0); } /*end get clock info*/ struct emp; void initData(int *clockNumberPtr,float *wagePtr,float *hoursWorkedPtr) { /* declaring clock numbers and wage*/ int i; // index for for loop emp[0].clockNumber=98401; /*first employee*/ emp[1].clockNumber=526488; /* second employee*/ emp[2]clockNumber=765349; /*third employee */ emp[3]clockNumber=34645; /*forth employee*/ emp[4]clockNumber=127615; /*fifth employee */ emp[0]wage=10.60; /* first employee wage emp[1]wage=9.75; /*second employee wage emp[2]wage=10.50; /* third employee wage */ emp[3]wage=12.25; /*employee 4 wage */ emp[4]wage=8.35; /* fifth employee wage 8/ // init hours worked to 0 for (i=0;i<5;i++) hoursWorkedPtr[i]=0; } /*end declaring clock and wage numbers*/ void getHoursWorked(struct employee emp[]) { /*prompt for hours*/ printf ("Enter hours worked by %d: ",clockNumberPtr[entry]); scanf_s("%f", &(hoursWorkedPtr[entry])); } /*end prompt for hours*/ float calculateOverTime(int entry, float *wagePtr,float *hoursWorkedPtr) { /* figure out overtime */ float overTimeHours=hoursWorkedPtr[entry]-40; float overTimePay=0; if (overTimeHours>0) overTimePay=overTimeHours*(wagePtr[entry]*1.5); return (overTimePay); } /* end figuring out overtime */ float calculateGrossPay(int entry, float *wagePtr,float *hoursWorkedPtr) { /* determine gross pay*/ float grossPay=0; if (hoursWorkedPtr[entry]>40) grossPay=(40*wagePtr[entry])+calculateOverTime(entry,wagePtr,hoursWorkedPtr); else grossPay=wagePtr[entry]*hoursWorkedPtr[entry]; return (grossPay); } /*end determine gross pay */void displayEntry(int entry, int *clockNumberPtr,float *wagePtr,float *hoursWorkedPtr){ /*desplay results */ printf ("%d\t%0.2f\t%0.2f\t%0.2f\t%0.2f\n", emp.clockNumber, emp.wage, emp.hoursWorked, calculateOverTime(entry,wagePtr,hoursWorkedPtr), calculateGrossPay(entry,wagePtr,hoursWorkedPtr)); } /* end desplay output*/ (end code) __________View the list's information and change your settings at //www.freelists.org/list/programmingblind
__________View the list's information and change your settings at //www.freelists.org/list/programmingblind