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<<"$";
}