Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What the FUCK

Name: Anonymous 2009-11-25 21:00

I keep getting "in main, syntax error before employee"
I've tried every conceivable solution, what the FUCK am I doing wrong?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define empmax  20
#define MAX_LEN 30
#define regtax  .10
#define overtax .20

struct employee{
  char first[MAX_LEN];
  char last[MAX_LEN];
  double payperhr;
  double gross;
  double taxes;
  double hours_in_week;
};

typedef struct employee employee;

void getclock(employee *array);
FILE *gfopen(char name[], char mode[]);

int main(){
   
   
    employee array[empmax];
   
    getclock(struct employee *array);
   
    system("pause");
   
    return 0;
}

void getclock(employee *array){
     char tempfirst[MAX_LEN], templast[MAX_LEN];
     int i, j, k, l, empnum, numweeks, numshifts;
     double timeinhr, timeinmin, timeouthr, timeoutmin, timeinshift, overhours, taxpayed, grossearned, netpay;
     FILE *input;
    
     input = gfopen("clock.txt", "r");
    
     fscanf(input, "%d", empnum);
     for(i=0; i<empnum; i++){
              fscanf(input, "%s %s %d", array[i].first, array[i].last, &array[i].payperhr);
              }
             
     //Scans number of weeks on file, goes through each week
     fscanf(input, "%d", &numweeks);
     for(i=0; i<numweeks; i++){
             
              //Scans for number of shifts in each week
              fscanf(input, "%d", &numshifts);
             
              //Goes through each shift
              for(j=0;j<numshifts;j++){
              fscanf(input, "%s %s", tempfirst, templast);
             
              //Finds out who the shift belongs to
              for(k=0;k<empnum;k++){
              //Adds all the hours in the shifts belonging to each person
              if(strcmp(array[k].first, tempfirst)==0 && strcmp(array[k].last, templast)==0){
              fscanf(input, "%lf %lf %lf %lf", &timeinhr, timeinmin, timeouthr, timeinmin);
                            timeinmin=timeinmin/60;
                            timeoutmin=timeoutmin/60;
                            timeinshift=(timeouthr+timeoutmin)-(timeinhr+timeinmin);
                            array[k].hours_in_week=array[k].hours_in_week+timeinshift;
                            }//Closes if statement
                            }//Closes shift ownership loop
                            }//Closes shift loop
                           
                            //Takes the hours worked in week for each person and calculates earnings and taxes
                            for(l=0;l<empnum;l++){
                            //Determines if hour worked for the person is over 40
                            if(array[l].hours_in_week>40){
                            overhours=array[l].hours_in_week-40;
                            grossearned=(overhours*array[l].payperhr*1.5)+(40*array[l].payperhr);
                            taxpayed=(overhours*array[l].payperhr*1.5)*.20+(40*array[l].payperhr)*.10;
                            array[l].gross=array[l].gross+grossearned;
                            array[l].taxes=array[l].taxes+taxpayed;
                            }
                           
                            else if(array[l].hours_in_week<41){
                            grossearned=array[l].payperhr*array[l].hours_in_week;
                            taxpayed=grossearned*.10;
                            }
                           
                            //Resets weekly hour counter
                            array[l].hours_in_week=0;
                           
                            }//Closes earnings and taxes calculation loop
                            }//Closes number of shifts counter
                            }//Closes weeks loop

                           
                           
//File open function
FILE *gfopen(char name[], char mode[]){
     FILE *input;
     input = fopen(name, mode);
     if(input == NULL)
     {
              printf("Error opening file %s, aborting.\n", name);
              exit(1);
              }
     return input;
}

Name: Anonymous 2009-11-26 3:26

>>16
This is C.  Take your Sepples bullshit to a relevant thread.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List