my programs function wont return

Hey guys I made a program where we need a function to do th paycalculations of an employee and i am having trouble returning the values from the function when i run this it gives me a weird return like $7.99e-10 something like that when it shouldnt be. I have been trying to find the bug for hours can someone please help me with this problem..

Last edited on
For example here in the function

if (hours <= 40)
hours = rhrs;

you are assigning uninitialized value rhrs to hours.
what do you mean by uninitialized values
What is the initial value of rhrs declared in the statement?

double rpay, overpay, grosspy, statetaxwith, fedtaxwith, socialsec, medicaretax, npay, rhrs, overhrs;double rpay, overpay, grosspy, statetaxwith, fedtaxwith, socialsec, medicaretax, npay, rhrs, overhrs;
i still seem a little lost . don't i need the if else statement there to get the value for regular hours pay and overtime hours pay...
One more what value will have hours after executing this statement?! What is the value of rhrs here?

if (hours <= 40)
hours = rhrs;
the same as hours entered
Here is your function

double paycalculations(double hours, double payrate, double fedtaxrate, double staterate, int option)
{
double rpay, overpay, grosspy, statetaxwith, fedtaxwith, socialsec, medicaretax, npay, rhrs, overhrs;

if (hours <= 40)
hours = rhrs;
else if (hours > 40)

Please show where did you enter value for rhrs;?
Its not suppose to be a value it is suppose to be found if the user enters in more than 40 hours then those hours are to be considered overtime with double pay, less then 40 is regular pay
What is the value of rhrs which you are assigning to hours? It is your statement:

hours = rhrs;

What will be the value of hours as th result of executing this statement? 10, 20 or maybe 100?!
Topic archived. No new replies allowed.