So far i haven't started the calculation of the program but more worried about getting the first and last name to copy over to the output file w2.... even when i try to put it into a printf output of the first and last name... if anybody can try to walk me through what im doing wrong it would be much aprriceated
Code:#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LEN 30 #define SIZE 20 struct employee { char* first[MAX_LEN]; char* last [MAX_LEN]; double payperhr; double taxes; double hours_in_week; }; void function(struct employee all); int main(){ int i; int week, employee_day; double minin,hrin; double minout,hrout; struct employee all; int num_employee; FILE* fp; function(all); system("pause"); return 0; } void function(struct employee all){ int i; int week, employee_day; double minin,hrin; double minout,hrout; int num_employee; FILE* ifp; FILE* ofp; ifp = fopen("clock.txt", "r"); fscanf(ifp, "%d", &num_employee); for(i=0; i< num_employee; i++) { fscanf(ifp, "%s%s%lf", &all.first[i], &all.last[i], &all.payperhr); } //printf("%s%s", all.first[1], all.last[1]); fscanf(ifp, "%d", &week); for(i=1; i<=week; i++) { fscanf(ifp, "%d", &employee_day); fscanf(ifp, "lf%lf%lf%lf", &minin, &hrin, &minout, &hrout); } ofp = fopen("w2.txt", "w"); fprintf(ofp, "Number of Employees: %d\n\n", num_employee); for(i=0; i<num_employee; i++) { fprintf(ofp, "W2 Form\n-------\n"); fprintf(ofp, "Name: \n"); fprintf(ofp, "Gross Pay: \n"); fprintf(ofp, "Taxes Withheld: \n"); fprintf(ofp, "Net Pay: \n"); fprintf(ofp, "\n"); } fclose(ifp); fclose(ofp); }



LinkBack URL
About LinkBacks


