hey guys.. click this

please help me.. idont know to write a function.. give me some idea?





#include <iostream>
#include <cstdlib>

using namespace std;

int main()
{
int nhw,rph,bp,oth,otp,gp,td,np,x,l;
string ne,pc;
float m,s,t;

cout<<"======================="<<endl;
cout<<"Number of Employee: ";
cin>>l;
cout<<"======================="<<endl;


for(x=1;x<=l;x++)
{
cout<<"NAME: ";
cin>>ne;
cout<<"POSITION: ";
cin>>pc;
cout<<"NO. OF HRS WORKED: ";
cin>>nhw;
cout<<"RATE PER HOUR: ";
cin>>rph;
cout<<"OVERTIME HOURS: ";
cin>>oth;
cout<<"======================="<<endl;

bp=nhw*rph;
otp=oth*(1.5*rph);
gp=bp+otp;
m=0.01*bp;
s=0.05*bp;

cout<<"Basic Pay: ";
cout<<bp<<"\n";
cout<<"======================="<<endl;


if(bp<=10000)
{
t=0.05*bp;
}
else if(bp<=15000)
{
t=0.10*bp;
}
else if(bp<=20000)
{
t=0.15*bp;
}
else
{
t=0.20*bp;
}


td=m+t+s;
np=gp-td;

cout<<"OT Pay: ";
cout<<otp<<"\n";
cout<<"======================="<<endl;
cout<<"Gross Pay: ";
cout<<gp<<"\n";
cout<<"======================="<<endl;
cout<<"TAX: ";
cout<<t<<"\n";
cout<<"SSS: ";
cout<<s<<"\n";
cout<<"MEDICARE: ";
cout<<m<<"\n";
cout<<"Total Deduction: ";
cout<<td<<"\n";
cout<<"======================="<<endl;
cout<<"NetPay: ";
cout<<np<<"\n";
cout<<"======================="<<endl;

}
cout<<"NOTHING FOLLOWS****"<<endl;

return EXIT_SUCCESS;
}
Topic archived. No new replies allowed.