This is just an exercise.
And i need to complete this.

This is the question :

Write a program in C++ that calculates the amount to be paid to an employee based on the hours worked and rate per hour. A user will enter hours worked and rate per hour for an employee. Your program should have a function payCheck that calculates and returns the amount to be paid. The formula for calculating the salary amount is as follows: for the first 40 hours, the rate is the given rate (the rate that a user has entered); for hours over 40, the rate is 1.5 times the given rate.


i had write my own coding, but it keeps error. it is okay.
Still running, but anyone can help me?
So, this is my coding.
The problem is i need to calculate if the employee work for more than 40 hours which 1.5 times.


Code:
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include <iostream.h>

using namespace std;


int main(void)
{
char *empname, *test, *final_output;
float hours=0, pay_rate=0, gross=0, net=0;

//loop
do {
/*-- get first & last name --*/
cout<<"Please Enter Your Name ";
cin>>empname;

/*--
get pay rate with error checking on
null and 0 values
--*/
do {
cout << "Pay Rate: ";
cin >> test;
if (test == NULL)
cout << "Invalid pay rate.";
else if(atof(test) != 0)
break;
else
cout << "Invalid pay rate.";
} while (1);
pay_rate=atof(test);

/*--
get hours worked with error checking on
null and 0 values
--*/
do {
cout << "Hours Worked: ";
cin >> test;
if (test == NULL)
cout << "Invalid amount of hours.";
else if(atof(test) != 0)
break;
else
cout << "Invalid amount of hours.";
} while (1);
hours=atof(test);

/*-- calculate values --*/
gross=hours*pay_rate;

/*-- set out precision --*/
cout.precision(2);
cout.setf(ios::fixed | ios::showpoint);

/*-- create output --*/
sprintf(final_output,"\n\n%s %s ssn(%s)\n------------------------------\n",
empname);
cout << final_output;
cout << "Gross: " << gross << endl;

/*-- do another? --*/
cout << "Calculate Another? (y/n)?";
cin >> test;

/*-- check first value of string for y/Y --*/
} while (!strncasecmp(test,"y",1));

return 0;
}