Function declaration

here is my code, im still getting an error and had no idea what to do!

# include <iostream.h>
void company_name(void);
int no_emp(int emp);
main ();
{
company_name();
no_emp(int emp);
loop(int no_loop);
return 0;
}
void company_name(void)
{
cout<<"Company Name \n";
}
int no_emp(int emp)
{
int e;
cout<<"enter no. of employee:";
cin>>e;
return (e);
}
int x,rate;
char pos;
{
for(x=1;x<=e;x++);
{
cout<<"M-Manager S-Supervisor T-Staff \n";
cout<<"Position";cin>>pos;
if(pos=='m'){rate=400;}
else if (pos=='s'){rate=350;}
else if (pos=='t'){rate=300;}
else{
cout<<"INVALID INPUT";
return 0;
}
int dw,hl,gross,sss=300,net,govmisc=100,sd;
double tax;
cout<<"Enter Days of worked";
cin>>dw;
cout<<"Enter Hours Late";
cin>>hl;
late=(rate/8)*hl;
gross=rate*dw;
cout<<"Salary Deduction\n";
cout<<"SSS:"<<sss<<"\n";
tax=gross*.10;
cout<<"Tax:"<<tax<<"\n";
cout<<"Miscellaneous:"<<govmisc<<"\n";
cout<<"Late"<<hl<<"\n";
sd=sss+tax+govmisc+hl;
net=gross-sd;
cout<<"NET:"<<net;
}
}

THis is the error??
5: error C2447: missing function header (old-style formal list?)
23: error C2447: missing function header (old-style formal list?)

any help please!
Hi, I'll try to help but it it difficult to read your code as you have not formatted it using the # (code) format.
It would also be useful if you included comments in your code, or additional text with your post, to indicate what you expect the code to do (otehrwise people might suggest changes which make it compile, but not do what you want)
(See http://www.cplusplus.com/forum/beginner/1/ for a load of info on how to make it easier for everyone:-)

Looking at the top I can see a number of problems
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
void company_name(void);
int no_emp(int emp);  //see below
main ();   //No ';' after main
{
   int emp;       //needed for return value if no_emp()
   company_name();
   emp = no_emp(int emp);  //see below 
   loop(int no_loop);   //function loop not declared ???
   return 0;
}

void company_name(void)
{
   cout<<"Company Name \n";
}

int no_emp(int emp)   //Not used
{
   int e;
   cout<<"enter no. of employee:";
   cin>>e;
   return (e);
}


I'd need to know more of what you intend to give more guidance.
Note that all the code after the end of no_emp() is not in a function or main, so will cause compiler errors.
thnks, what im trying to do is to make 4 function to get the total net of a certain employee, wherein I could loop and used the form as many times as the no. I input in no. of employee...where in it could process the employee position, the hours late and days work which has a rate as indicated in my program to get the gross,
and secondly by deducting the total salary deduction to get the total net of a certain employee...hope this clears out my intentions!thank you...
OK,
It looks like you need a function int payRate() which would handle entering the position and return the rate, and then a function void netPay(int rate) which would take the rate as a parameter and display the net pay.
You have the code for these two functions already (just not in functions).
Modify main() to use a for loop to call payRate() and netPay() for each employee.
If you haven't done so already, take a look at the C++ tutorial on this site (http://www.cplusplus.com/doc/tutorial/) as it has pleanty of nice examples to help you along.
Topic archived. No new replies allowed.