Hey guys i have 2 syntax errors all in the else statement
syntax error before or at else :
syntax error before or at PostCode: can anyone see any problems?
Code:#include "ts.h" #include "ts_utility.h" #include "ts_options.h" /**************************************************************************** * Menu option #1: Add Customer * Allows the user to add a new customer record to the linked list. ****************************************************************************/ void addCustomer(TennisStoreType* ts) { /* declaration of variables*/ char tmpSurname[SURNAME_MAX + 1]; char tmpFirstName[FIRSTNAME_MAX + 1]; char tmpAddress[ADDRESS_MAX + 1]; char tmpSuburb[SUBURB_MAX + 1]; char tmpPostCodePtr[10]; char tmpPhonePtr[10]; int PostCode[POSTCODE_LEN + 1]; int PhoneNum[PHONENUM_LEN + 1]; int finished = FAILURE; CustomerNodeType* curCust = ts -> headCust; CustomerNodeType* newCust; CustomerNodeType* prevCust; do { printf("Surname: (1-12 characters)\n"); fgets(tmpSurname, SURNAME_MAX + 2, stdin); /* check the range of surname */ if(tmpSurname[strlen(tmpSurname) -1] != '\n'); { printf("Surname too long less that 12\n\n"); } /* fails if empty line is pressed*/ if(tmpSurname[0] == '\n') { printf("\t\n*****back to main menu*****"); /*return FAILURE;*/ } }while(tmpSurname[strlen(tmpSurname)-1] != '\n'); tmpSurname[strlen(tmpSurname)-1] = '\0'; while(validCustSurname(ts, tmpSurname) == FAILURE) { printf("Customer exists already. Try again!\n\n"); do { printf("Enter a customer surname (1-12)"); fgets(tmpSurname, SURNAME_MAX + 2, stdin); /* check if surname is longer then the constant variable*/ if(tmpSurname[strlen(tmpSurname)-1] != '\n') { printf("Customer surname too long! Has to be less than 12\n\n"); readRestOfLine(); } /* stop processing if empty line is entered*/ if(tmpSurname[0] == '\n') { printf("***Returning to the main menu***"); /* return FAILURE;*/ } }while(tmpSurname[strlen(tmpSurname)-1] != '\n'); tmpSurname[strlen(tmpSurname)-1] = '\0'; } /********** input for first name**********/ do { printf("First Name: (1-12 characters)\n"); fgets(tmpFirstName, FIRSTNAME_MAX + 2, stdin); /* check the range of surname */ if(tmpFirstName[strlen(tmpFirstName) -1] != '\n'); { printf("First Name too long less that 12\n\n"); } /* fails if empty line is pressed*/ if(tmpFirstName[0] == '\n') { printf("\t\n*****back to main menu*****"); /*return FAILURE;*/ } }while(tmpFirstName[strlen(tmpFirstName)-1] != '\n'); tmpFirstName[strlen(tmpFirstName)-1] = '\0'; /********* enter Address *********/ do { printf("Address: (1-20 characters)\n"); fgets(tmpAddress, ADDRESS_MAX + 2, stdin); /* check the range of surname */ if(tmpAddress[strlen(tmpAddress) -1] != '\n'); { printf("Address too long less that 20\n\n"); } /* fails if empty line is pressed*/ if(tmpAddress[0] == '\n') { printf("\t\n*****back to main menu*****"); /*return FAILURE;*/ } }while(tmpAddress[strlen(tmpAddress)-1] != '\n'); tmpAddress[strlen(tmpAddress)-1] = '\0'; /************ suburb ************/ do { printf("Suburb: (1-12 characters)\n"); fgets(tmpSuburb, SUBURB_MAX + 2, stdin); /* check the range of suburb */ if(tmpSuburb[strlen(tmpSuburb) -1] != '\n'); { printf("Suburb too long less that 12\n\n"); } /* fails if empty line is pressed*/ if(tmpSuburb[0] == '\n') { printf("\t\n*****back to main menu*****"); /*return FAILURE;*/ } }while(tmpSuburb[strlen(tmpSuburb)-1] != '\n'); tmpSuburb[strlen(tmpSuburb)-1] = '\0'; /*********PostCode*********/ do { printf("PostCode: (4 - digits)\n"); fgets(tmpPostCodePtr, POSTCODE_LEN + 2, stdin); /* fails if empty line is pressed*/ if(tmpPostCodePtr[0] == '\n') { printf("\t\n*****back to main menu*****"); /*return FAILURE;*/ } /* check the range of postcode */ if(tmpPostCodePtr[strlen(tmpPostCodePtr) -1] != '\n'); { printf("PostCode too long 4 digits\n\n"); readRestOfLine(); } else { tmpPostCodePtr[strlen(tmpPostCodePtr) -1] = '\0'; finished = SUCCESS; } PostCode = atoi(tmpPostCodePtr); }while(finished == FAILURE); } /**************************************************************************** * Menu option #2: Add Stock * Allows the user to add a new stock record to the linked list. ****************************************************************************/ void addStock(TennisStoreType* ts) { } /**************************************************************************** * Menu option #3: Delete Record * Allows the user to remove one or more records from the customer and/or * stock linked lists. Partial string matching is implemented. ****************************************************************************/ void deleteRecord(TennisStoreType* ts) { } /**************************************************************************** * Menu option #4: Display Customer * Displays a list of customers in the system in a tabular format. ****************************************************************************/ void displayCustomer(TennisStoreType* ts) { } /**************************************************************************** * Menu option #5: Display Stock * Displays a list of stock records in the system in a tabular format. ****************************************************************************/ void displayStock(TennisStoreType* ts) { } /**************************************************************************** * Menu option #6: Make Sale * Allows the user to make sales. Stock levels are decremented and sales * records are appended to a csv data file. ****************************************************************************/ void makeSale(TennisStoreType* ts, char* saleFile) { } /**************************************************************************** * Menu option #7: Sales log * This function outputs the contents of a sales log file. ****************************************************************************/ void salesLog(TennisStoreType* ts, char* saleFile) { } /**************************************************************************** * Menu option #8: Save and Exit * Saves all system data back to the original files. This function does not * terminate the program - this is left to the main() function instead. ****************************************************************************/ void saveData(TennisStoreType* ts, char* customerFile, char* stockFile) { }



LinkBack URL
About LinkBacks


