Line 10 keeps on getting a Type "Double" Unexpected
Any idea what the problem is?

#include<iostream>
using namespace std;

double grossPay(double a, double b);

int main(){	
	double a,b;
	cout << "Hours worked this week and hourly rate of pay";
	cin >> a >> b;
cout << double grossPay(a,b); 
									 
system("pause");
}
double grossPay(double a, double b)
{
	if(a<0 || a>168 || b<0){
		cout << "You must enter a number that is no less than 0 and no greater than 168" << endl;
		system("pause");
		exit(EXIT_FAILURE);
	}else if ( a>40 ){
			   ((a-40) * (b) * (a) * (1.5)) == grossPay(a,b);
	}else 
	(a * b) == grossPay(a,b);
	return grossPay(a,b);
}

Why did you put the word double there? grossPay already returns a double.

So you can just remove the word double on line 10.

Get rid of the word "double" in line 10:

cout << double grossPay(a,b);

Change it to this:

cout << grossPay(a,b);

That solves that problem but you have quite a few other problems in your grossPay function. For instance, what is this line supposed to do?

((a-40) * (b) * (a) * (1.5)) == grossPay(a,b);

Thanks a bunch!

#include<iostream>
using namespace std;

double grossPay(double a, double b);

int main(){	
double a=1, b=1;
cout << grossPay(a,b) << endl;
									 
system("pause");
}
double grossPay(double a, double b)
{
	double x;
	cout << "Hours worked this week and hourly rate of pay" << endl;
	cin >> a >> b;
	if(a<0 || a>168 || b<0){
		cout << "You must enter a number that is no less than 0 and no greater than 168" << endl;
		system("pause");
		exit(EXIT_FAILURE);
	}else if ( a>40 )
			  x = (((a-40) * (b*1.5))+(40*b));
	else 
	x = a*b;
	return x;
}
This article has been dead for over six months. Start a new discussion instead.