-Read two integers, representing a rate of pay (pence per hour) and a number of hours. Print out the total pay, with hours up to 40 being paid at basic rate, from 40 to 60 at rate-and-a-half, above 60 at double-rate. Print the pay as pounds to two decimal places.
-Terminate the loop when a zero rate is encountered. At the end of the loop, print out the total pay.
-The code for computing the pay from the rate and hours is to be written as a function.
-The recommended output format is something like:
Pay at RM30 /hr for 38 hours is RM1140
Pay at RM45 /hr for 48 hours is RM2160
Pay at RM60 / hr for 65 hours is RM3900
Total pay is RM7200
below is the code that i made.. but i m not sure how to get the total.
pls guide my mistake. im using borland 5.02
# include <stdio.h>
#include <conio.h>
int loop();
float rate();
float hour();
main ()
{
loop ();
getch();
return 0;
}
int loop()
{
int i=1;
while(i)
{
hour();
}
getch();
return 0;
}
float hour()
{
float a,c, rate();
{
printf ("\nKey in rate of pay: ");
scanf ("%f", &a);
printf ("\nKey in number of hours: ");
scanf ("%f", &c);
printf ("\nPay at RM%.2f /hr for %.2f hours is RM: %.2f", a,c,rate);
}