User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 397,646 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,446 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 144 | Replies: 1
Reply
Join Date: Jul 2008
Posts: 1
Reputation: grayCplus is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
grayCplus grayCplus is offline Offline
Newbie Poster

4 functions

  #1  
Jul 8th, 2008
here is my code, im still getting an error and had no idea what to do! 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

# include <iostream.h>
void company_name(void);
int no_emp();
main ()
{
int company_name(void);
int no_emp(int e);
return 0;
}
void company_name(void)
{
cout<<"Company Name \n";
}
int no_emp(int e)
{
cout<<"enter no. of employee:";
cin>>no_emp(int e);
return (no_emp);
int loop (no_emp);
}
int x,rate;
char pos;
int loop (no_emp)
{
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{
rate=300;}
return 0;}
double dw,hl,gross,sss=300,net,misc=100,sd;
double tax;
cout<<"Enter Days of worked";
cin>>dw;
cout<<"Enter Hours Late";
cin>>hl;
hl=(rate/8)*hl;
gross=rate*dw;
cout<<"Salary Deduction\n";
cout<<"SSS:"<<sss<<"\n";
tax=gross*.10;
cout<<"Tax:"<<tax<<"\n";
cout<<"Miscellaneous:"<<misc<<"\n";
cout<<"Late"<<hl<<"\n";
sd=sss+tax+pagibig+hl;
net=gross-sd;
cout<<"NET:"<<net;
return (e);
}
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,598
Reputation: niek_e is just really nice niek_e is just really nice niek_e is just really nice niek_e is just really nice 
Rep Power: 8
Solved Threads: 163
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: 4 functions

  #2  
Jul 8th, 2008
Quite a few errors actually.
Perhaps you should look at a tutorial for functions first.

But because you took the time to learn about code-tags (good job!), I'll give you a start on your program:
  1. # include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void company_name(void);
  6. int no_emp(void);
  7.  
  8. int main ()
  9. {
  10. company_name();
  11. int e = no_emp();
  12. cout << "number of employees: " << e;
  13. cin.ignore();
  14. cin.get();
  15. return 0;
  16. }
  17. void company_name(void)
  18. {
  19. cout<<"Company Name \n";
  20. }
  21.  
  22. int no_emp()
  23. {
  24. int number_of_emp;
  25. cout<<"enter no. of employee:";
  26. cin>>number_of_emp ;
  27. return number_of_emp;
  28. }

Study this example and compare it to the code you created. That way you can easily see where your errors are/were.

Also this: # include <iostream.h> probably means that you're using TurboC++ ? I would strongly suggest that you upgrade to a compiler from this millenium.
A few free ones are:
Visual Studio
Code::blocks
Dev-C++
do NOT pm me for help, it makes me angry. You wouldn't like me when I'm angry...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 11:01 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC