Alright, I can figure out why but when I run my program, it will display the menu function and when I input 1 as my choice it does not call my "hire" function. Instead the menu just reprints and waits for my input again.
Code:int main(void) { char firstName[5][20]={' '}; char lastName[5][20]={' '}; char class[5][20]; int id[5]={0}; double pay[5]={0}; int numEmploy=0; int choice=1; while(choice>=1 && choice<=6) { menu(); scanf("%d", &choice); switch(choice) { case 1: hire(firstName, id, &numEmploy); break; case 2: //pay function here break; case 3: //promote function here break; case 4: //transfer function here break; case 5: //print single emploee break; case 6: //print all employees break; case 7: printf("Exiting program\n"); break; default: printf("Invalid input\n"); } } return(ZEROI); }No the hire function is not finished. I just want to test what is there currently.Code:void hire(char firstName[][20], int id[], int *numEmploy) { int ident, i; if(numEmploy <= 4) { printf("Enter a 5 digit id: "); scanf("%d", &ident); for(i=ZEROI; i<MAX_EMPLOYEE; i++) { if(ident==id[i]) { printf("There is already an employee with this id number\n"); //else if( } } }



LinkBack URL
About LinkBacks


