Hi,
I runned that program with int variables and was OK but when I changed the type of
pay_calc(),*emp_rate,pay
from integer to float I failed ..Please Help
main()
{
int *emp_no,*emp_works;
int pay_calc(),*emp_rate,pay;
char *emp_unit,ans,another();
system("cls");
do {
input(&emp_no,&emp_works,&emp_rate,&emp_unit);
pay=pay_calc(emp_works,emp_rate,emp_unit);
pay_slip(emp_no,emp_works,emp_rate,emp_unit);
cash(pay);
} while (another()=='y');
return 0;
}
char another()
{
char answer;
printf("\nAnother Employee (y/n) : ");
scanf("\n");
scanf("%c",&answer);
return (answer);
}
input (emp_n,emp_w,emp_r,emp_u)
int *emp_n,*emp_w;
int *emp_r;
char *emp_u;
{
printf ("\n Enter the Employee number : ");
scanf("%d",emp_n);
printf ("\n Enter the Employee Pay Based unit (weeks or hours) : ");
scanf("\n");
scanf("%c",emp_u);
if ((*emp_u)=='w')
{
printf ("\n Enter the number of weeks :");
scanf("%d",emp_w);
printf ("\n Enter the rate of paying for each week :");
scanf("%d",emp_r);
}
if ((*emp_u)=='h')
{
printf ("\n Enter the number of hours :");
scanf("%d",emp_w);
printf ("\n Enter the rate of paying for each hour :");
scanf("%d",emp_r);
}
return 0;
}
int pay_calc(emp_w,emp_r,emp_u)
int emp_w;
int emp_r;
char emp_u;
{
int p=0.0;
p=(emp_r)*(emp_w);
if (emp_u=='h')
printf ("\nThat pay for hours %d worked with rate %d is = %d",emp_w,emp_r,p);
if (emp_u=='w')
printf ("\nThat pay for Weeks %d worked with rate %d is = %d",emp_w,emp_r,p);
return ((emp_r)*(emp_w));
}