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