
Help with functions
Can anyone help me with this question? I have only done basic C stuff, and I don't think we've touched upon Functions yet:
Write a program to input the number of workers followed by hours worked, hourly rate of pay, overtime rate of pay, status (married or single) for each.
The main program must use separate functions and appropriate parameters.
Suggested functions include:
a) Calculate the gross pay (overtime rate is paid for any number of hours above 40);
b) Calculate the amount of tax paid (25% if Married and 30% if Single);
(c) Display all the details on a payslip.
Many thanks for any help you may be able to offer
Stefanie <3

The use of basic functions follows a standard format: Code:
//Declare prototypes
// return_type function_name (parameter_one, parameter_two, ...);
float CalculatePay(float hours, float hourlyPay, float overtime);
// ... and so on
// call the function
int main()
{
float hours, hourlyPay, overtime, totalPay;
// read in your data  i.e. cin >> hours; .........
// send data to the function
totalPay = CalculatePay(hours, hourlyPay, overtime);
return 0;
}
// define the function
float CalculatePay(float hours, float hourlyPay, float overtime)
{
// code for what the function is supposed to do
// return a value if there is a return type  not void
return some_float_value;
}
This should be enough to get you started. If you have problems once you have started, let me know.
David

Hi Stefanie.
Are you at Tameside College?
We have just done a very similar excersise.