QUOTE(Amadeus @ 13 May, 2007 - 06:46 AM)

What ate the errors you are receiving?
The problem I see is where you call the function here:
CODE
cout << "\nTotal" << setw(8) << fixed << setprecision(2) << totalHoursParked << setw(14) << totalParkingFees <<endl <<endl;
First,you are treating the function call like a variable. It is not. As well, you are not actually passing any parameters to the function. It likely needs to resemble the following:
CODE
cout << "\nTotal" << setw(8) << fixed << setprecision(2) << totalHoursParked(hoursParkedCar1,hoursParkedCar2,hoursParkedCar3) << setw(14) << totalParkingFees <<endl <<endl;
Finally, your function prototype declares the function as return type void, whereas you clearly return a double. The prototype will need to be modified.
----------------
Ok,
I made the changes suggested and I still get the following 2 errors at compile time:
I appreciate the help.
- G
1 - Error 1 error LNK2019: unresolved external symbol "double __cdecl totalHoursParked(double,double,double)" (?totalHoursParked@@YANNNN@Z) referenced in function _main main.obj
2- Error 2 fatal error LNK1120: 1 unresolved externals
Here is entire source
CODE
#include<iostream>
#include<iomanip>
using namespace std;
//function prototype defined after end main
double calculateCharge(double);
double totalHoursParked(double, double, double);
int main()
{
double hoursParkedCar1 = 0; //store hours for 1st parked car
double hoursParkedCar2 = 0; //store hours for 2nd parked car
double hoursParkedCar3 = 0; //store hours for 3rd parked car
/*double totalHoursParked = 0;*/ //store value for the aggregate hours parked
double totalParkingFees = 0; //store value for the total aggregate fees
char response = 'x'; //store junk value to quit the program or continue
//perform the exercise as long as the quit value is not entered
do
{
//Ask the user to input the hours parked for three cars
cout << "\nEnter hours parked for 3 customers (hrs hrs hrs): ";
cin >> hoursParkedCar1 >> hoursParkedCar2 >> hoursParkedCar3;
/*
Not sure if it was required to ask the question repeatedly ?
*/
//calculate the aggregate hours parked
//totalHoursParked = hoursParkedCar1 + hoursParkedCar2 + hoursParkedCar3;
//calculate the aggregate fees charged
totalParkingFees = (calculateCharge(hoursParkedCar1)) + (calculateCharge(hoursParkedCar2)) + (calculateCharge(hoursParkedCar3));
//output to the headings to the screen
cout << "\n" << "Car" << setw(10) << "Hours" << setw(15) << "Charge\n";
//output the values for each car to the screen
cout << "1" << setw(12) << fixed << setprecision(2) << hoursParkedCar1 << setw(14) << fixed << setprecision(2) << calculateCharge(hoursParkedCar1) << endl;
cout << "2" << setw(12) << fixed << setprecision(2) << hoursParkedCar2 << setw(14) << fixed << setprecision(2) << calculateCharge(hoursParkedCar2) << endl;
cout << "3" << setw(12) << fixed << setprecision(2) << hoursParkedCar3 << setw(14) << fixed << setprecision(2) << calculateCharge(hoursParkedCar3);
//output the aggregate values to the screen
cout << "\nTotal" << setw(8) << fixed << setprecision(2) << totalHoursParked(hoursParkedCar1,hoursParkedCar2,hoursParkedCar3) << setw(14) << totalParkingFees <<endl <<endl;
//ask the user to quit & read in their response
cout << "Would you like to quit y or n ?";
cin >> response;
//contine the loop if the response is not y
}while(response != 'y');
system("pause");
return 0;
}//end of main
//define the function calculateCharge
double calculateCharge(double hours)
{
double charge = 0; //initialize the variable charge
//calculate the value of charge depending on hours to calculate fees
if(hours <= 3)
{
charge = 2;
}
else if(hours > 3 && hours < 19)
{
charge = (2 + .50 * (hours - 3));
}
else if(hours >= 19)
{
charge = 10;
}
return charge;
}//end of function calculateCharge
double calculateHoursParked(double hoursParkedCar1, double hoursParkedCar2, double hoursParkedCar3)
{
double totalHoursParked = 0;
totalHoursParked = hoursParkedCar1 + hoursParkedCar2 + hoursParkedCar3;
return totalHoursParked;
}