When i rebuild the program , I get this error

1>c:\users\agaba\documents\visual studio 2005\projects\car\car\school.cpp(97) : error C2447: '{' : missing function header (old-style formal list?)
1>Build log was saved at "file://c:\Users\agaba\Documents\Visual Studio 2005\Projects\car\car\Debug\BuildLog.htm"
1>car - 1 error(s), 0 warning(s)


The code ..................

// Short-term parking at the airport, from 4am to midnight.

#include <iostream>
 using namespace std;
 // function

 void AskTimeIn(int *pHourIn,int *pMinIn);
 void AskTimeOut(int *pHourOut,int *pMinOut);
 bool validTime(int hoursIn,int minsIn,int hoursOut,int minsOut);
float calcuLateFee(int hoursIn,int minsIn,int hoursOut,int minsOut,float *pFees,float *pTotalTime);
 void write(int hoursIn,int minsIn,int hoursOut,int minsOut);

int main()
 {
  int hoursIn, minsIn,hoursOut, minsOut;
  float fees,totalTime;


  // difine  fuction


  AskTimeIn(&hoursIn,&minsIn); //time in function.

  AskTimeOut(&hoursOut,&minsOut);//time out function.
  
 validTime(hoursIn,minsIn,hoursOut,minsOut);// check  the time.
calcuLateFee(hoursIn,minsIn,hoursOut,minsOut,&fees,&totalTime);// calculate late fees function.
  write(hoursIn,minsIn,hoursOut,minsOut);// write result function.

return 0;
 }

void AskTimeIn(int *pHourIn,int *pMinIn)
{
 char colon;
	cout <<"\n Enter Time  in ,H:M format(24hour clock): ";
	cin >>*pHourIn>>colon>>*pMinIn;
	cin.ignore();

}
void AskTimeOut(int *pHourOut,int *pMinOut)
{
 char colon;
 cout <<"\n Enter Time out ,H:M format(24hour clock): ";
 cin>>*pHourOut>>colon>>*pMinOut;
 cin.ignore();

}
 bool validTime(int hoursIn,int minsIn,int hoursOut,int minsOut)
 {
 do
 {
   if(hoursIn<=24 && minsIn<=59 && hoursOut<=24 && minsOut<=59)
    {
     if (hoursIn < hoursOut )
	 {
            return true;
	 }
     else if ( hoursIn == hoursOut )
     {
            if( minsIn < minsOut )  //assume no in/out same minute
                 return true;
      }
   }
  }while(false);
 }

 float calcuLateFee(int hoursIn,int minsIn,int hoursOut,int minsOut,float *pFees,float *pTotalTime)
 {
 int totalHours;
 int totalMins;

 totalHours=hoursOut-hoursIn;  // calculate total hours car parked.

 totalMins=minsOut-minsIn;   // calculate total min car parked.
 
*pTotalTime =static_cast<float>( totalHours/60 + totalMins); // calculate total time car pared in minutes.

 if(*pTotalTime<=30)
 {
   *pFees=(float)2.00;
 }
 else
 {
	 if(*pTotalTime<60)
	 {
	   *pFees=(float)4.00;
	 }
	 else
	 {
	*pFees = *pTotalTime/30*(float)2.00;
	 }
 }
 }

 void write(float totalTime,float fees);
 {
 cout<<"\n Total Time Car parked :"<<totalTime<<"minutes";
 cout<<"\n Total fees  :"<<fees<<"$";
 }

Here's a snippet of your code reworked!
Please use it as a foundation for redoing your code!

And use Indentation next time!

//@@@ NOTE: You are using FLAT rates so integer would have been fine! No need for floating-point!

//float calcuLateFee(int hoursIn,int minsIn,int hoursOut,int minsOut,float *pFees,float *pTotalTime)
float calcuLateFee(int hoursIn,int minsIn,int hoursOut,int minsOut, float *pTotalTime)
{
	int totalTime;
	int totalHours;
	int totalMins;
	float Fees;					//@@@ Make fees the return value

	totalHours=hoursOut-hoursIn; // calculate total hours car parked.

	totalMins=minsOut-minsIn; // calculate total min car parked.
	totalTime = totalHours * 60 + totalMins;	//@@@ Calculate total time units
	*pTotalTime = static_cast< float >(totalTime);
//@@@ WRONG	*pTotalTime =static_cast<float>( totalHours/60 + totalMins); // calculate total time car pared in minutes.

//@@@	if(*pTotalTime<=30)
	if (totalTime <= 30)			//@@@ < 30 minute $2 flat fee
	{
//@@@	Fees= (float)2.00;
		Fees = 2.0f;
	}
		//@@@ I removed the else!
//@@@	else if(*pTotalTime<60)
	else if (totalTime <= 60)		//@@@ 31...60 minutes
	{
//			Fees=(float)4.00;
			Fees = 4.0f;
	}
	else							//@@@ $2 every 30 minutes
	{
//		Fees = *pTotalTime/30*(float)2.00;
		Fees = ((totalTime + 30-1 ) / 30.0) * 2.0f;	// round up!
	}

	return Fees;	//@@@ Missing return value
}

However, you only have a flat fee as there was no real tier schedule. It was always $2 for every 30 minutes so you didn' t need the if then's. All you needed was...

Fees = ((totalTime + 30-1 ) / 30.0) * 2.0f;	// round up!

but i have fees and totalTime as pointer and have the function
calculLateTime() function return two varible

Fine! If it was specified for you to use a pre-defined function then you have a problem. It returned nothing and nothing was to return since you passed the time and fees pointers. But it was declared to return a float.

The point is you had a math bug, were casting needlessly doubles into floats instead of indicating they were floats. Had that multi-conditional where none was needed and was not charging for remainder minutes.

Fine! If it was specified for you to use a pre-defined function then you have a problem. It returned nothing and nothing was to return since you passed the time and fees pointers. But it was declared to return a float.

The point is you had a math bug, were casting needlessly doubles into floats instead of indicating they were floats. Had that multi-conditional where none was needed and was not charging for remainder minutes.

ohoo ok

so how can make calclateLateFees() return fees and totaltime

The way I had it. that function has no failure so a return of bool won't work. A function can only have one return value and fees seemed the logical return value. Technically speaking it didn't make much sense to me for your double purpose function.
Make two functions.
One pass in two hours, two minutes and have it return total minutes.
This function only accept total minutes and return fees.

The way I had it. that function has no failure so a return of bool won't work. A function can only have one return value and fees seemed the logical return value. Technically speaking it didn't make much sense to me for your double purpose function.
Make two functions.
One pass in two hours, two minutes and have it return total minutes.
This function only accept total minutes and return fees.

but i have to use pointer,addresses and the indirection operator to give me more than one data item from a function , by using a function call by reference using pointer, that where i have most of my problem

This article has been dead for over six months. Start a new discussion instead.