My compiler says the Declaration syntax error is at (88,2) which is one of the brackets?

I don't really know what could be wrong. Help please. I'm really new at this.

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>

#define STD_HOURS 40.0
#define OT_RATE 1.5

int clock[5] = {98401, 526488, 765349, 34645, 127615};                              /*initialized arrays clock and wage */
float wage[5] = {10.60, 9.75, 10.50, 12.25, 8.35};

float gross [5];         /* employees gross income */
float hours[5];          /* number of hours employee worked */
float overtime[5];       /* hours of overtime worked */

int i;

main ()
{

void get_hours (void);
void calculate_gross (void);
void calculate_overtime (void);
void display_output (void);
int loop_check (void);
int answer;


	do
	{
   get_hours ();
   calculate_gross ();
   calculate_overtime ();
	display_output ();

   answer = loop_check ();
   }
   while( answer == 1);

}


/* Has user input hours worked */

void get_hours (void)
{
   int i;

		printf ("Clock#    Wage   Hours\n");

		for ( i = 0; i < 5; ++i)
         	{
            printf("%6i   %5.2f   ",clock[i], wage[i]);
            scanf("%f", &hours[i]);
            system("cls");
            }
}

/* Calculates gross pay */

void calculate_gross (void)
{
	int i;

	for(i = 0; i < 5; ++i)
   {
 	gross[i] = (hours[i] > STD_HOURS) ? wage[i]*STD_HOURS+(hours[i]-STD_HOURS)*OT_RATE*wage[i] : wage[i]*hours[i];
   }
{

/* Calculates overtime */

void calculate_overtime (void)
{
	int i;

   for(i = 0; i < 5; ++i)
   {
     overtime[i] = (hours[i] > STD_HOURS) ? hours[i] - STD_HOURS : 0;
   }
}

/* Displays output */

void display_output (void)
{                                                              <-----RIGHT HERE (88,2)
   	printf("-------------------------------------------\n");
      printf("Clock#    Wage   Hours     OT    Gross \n");
      printf("-------------------------------------------\n");

      for(i = 0; i < 5; ++i)
      {
      	printf("%6i   %5.2f   5.1f   %4.1f   %6.2f\n", clock[i], wage[i], hours[i], overtime[i], gross[i]);
      }
}


int loop_check (void)
{
int answer;

 printf("\nWould you like you enter different hours? (1=yes/2=no)");
      scanf("%i", &answer);
      return (answer);

}

Edited 6 Years Ago by omGac0W: n/a

Learn this basic rule of putting brackets .... This will make coding less of a night mare
Each time you introduce a new if/ for in a function press tab...
For example

void func1()
{
         for(;;)
         {
                  if()
                  {
                   
                   }
         }
}

Your code is terribly indented :S...though it didn't look a starter's code...
Anyways, I think you got the wrong brace at line no 71.

Always use int main(void) as the standard main function call, with return 0; at the end.
Also don't use conio.h as it is outdated (used for Turbo C)
Proper coding will always help you to lessen and also easily identify errors in your code...

Happy coding :)

Yea that was the problem thanks :D.

The awful indentation is because for some reason when I copy/paste code in the post box it gets all mess up. This is probably because there is a better way than copy/pasting code? How do I get it to like like it is in my compiler?

I don't feel that copying a properly indented code from your editor and pasting it to the post area, is in any way, going to "mess up" all.
By the way, which editor are u using ????

Borland C++. Its my dads and is preeeetty ancient.

Yea I just tried it again. Weird. It gets all messed up when I copy/paste.

#include "stdio.h"
#include "conio.h"
#define p printf
#define s scanf
main(){
       //variables
       int NOH;
       int RPH;
       int SSSdeduction;
       int PhilHealth;
       int PagIbig;
       int totalDeductions;
       int tax;
       int netPay;
       int grossPay;
       int basicPay;
       int honorarium;
       int overtimeHours;
       int regularPay;
       int overtimeRate;
       int overtimePay;

       // output && computations

       p("----------------------------------------------------------------\n\n\n");
       p("\t\t\t Payroll System\n\n\n");
       p("----------------------------------------------------------------\n\n\n");
       p("\nEnter number of hours worked: \t");
       s("%d",&NOH);

       p("\n\nRate per hour: \t\t\t");
       s("%d",&RPH);

       overtimeRate=RPH*1.25;
       p("\n\nOvertime Rate: \t\t\t%d",overtimeRate);

       {
       if(NOH>80)

                  overtimeHours=NOH-80;

       else 
            overtimeHours=0;
            }
       p("\n\n\nOvertime Hours: \t\t%d",overtimeHours);



       regularPay=(NOH-overtimeHours)*RPH;     
       p("\n\n\nRegular Pay: \t\t\t%d",regularPay);


       overtimePay=overtimeHours*overtimeRate;
       p("\n\n\nOvertime Pay: \t\t\t%d",overtimePay);


       basicPay=regularPay+overtimePay;
       p("\n\n\nBasic Pay: \t\t\t%d",basicPay);

       {
       if(basicPay>30000)

                         honorarium=2000;   

       else 
            honorarium=1000;
            }

       p("\n\n\nHonorarium: \t\t\t%d",honorarium);



       grossPay=basicPay+honorarium;
       p("\n\n\nGross Pay: \t\t\t%d",grossPay);


       p("\n\n\n\n--------------------------------------------------------\n\n\n");
       p("\t\t\t Salary Deductions\n\n\n");
       p("----------------------------------------------------------------\n\n");


       tax=grossPay*.15;
       p("\n\n\nTax: \t\t\t\t%d",tax);


       p("\n\n\nSSS: \t\t\t\t");
       s("%d",&SSSdeduction);

       p("\n\n\nPhilHealth: \t\t\t");
       s("%d",&PhilHealth);

       p("\n\n\nPagIbig: \t\t\t");
       s("%d",&PagIbig);

       totalDeductions=tax+SSSdeduction+PhilHealth+PagIbig;
       p("\n\n\nTotal Deductions: \t\t%d",totalDeductions);

       netPay=grossPay-totalDeductions;
       p("\n\n\nNetpay: \t\t\t%d",netPay);

       getch();
       }
//end

pls. help me here

***my compiler isTURBO C

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This article has been dead for over six months. Start a new discussion instead.