first attempt:
#include
#include
#include
int(HoursParked, string enterTime, string exitTime)
float parkingFee (Int hours);
string enterTime, exitTime;
cout <<"Please enter the date and time the car is entering "<< endl
<< "the parking garage in the following format: DD/MM/YY hh:mm"<< endl;
getline (cin, enterTime);
cout<< "Please enter the date and time the car is exiting "<< endl
<< "the parking garage in the following format: DD/MM/YY hh:mm"<< endl;
getline(cin, exitTime);
cout(feedue)<
return 0;
int HoursParked (string)
int TotalDays=stringToInt (exitTime.subr(3,2))stringToInt(enterTime)
int TotalDays=stringToInt (exitTime.subr(9,2))stringToInt(enterTime)
int TotalDays=stringToInt (exitTime.subr(12,2))stringToInt(enterTime)
Hours=(TotalDays>0)? (TotalHours +24*TotalDays);
Hours=(TotalMins>0)? Total+1; TotalHours
if (Hours<=3)
else
{
second attempt: ( this on just tells you the amount for 3 or less hours, i dont know how to modiify it after that) #include
#include
#include
#include
#include
#include
#include
using namespace std;
stringstream ss;
string enter_date;
string enter_time;
string exit_date;
string exit_time;
int calculatecharge;
int num;
int i;
int year;
int month;
int ddmmyyChar;
int dayStr;
string line;
int x;
int hr;
void atk()
{
getline (cin,line);
stringstream ss1(line);
ss >> enter_date >> enter_time;
stringstream ss2(enter_date);
string year, month, day;
getline (ss2, year, '/');
}
int main()
{
cout << "Please enter the date and time the car is entering "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
atk();
cout << "Please enter the date and time the car is exiting "<< endl
<< "the parking garage in the following format: YY/MM/DD hh:mm"<< endl;
atk();
if (hr - hr < 3)
cout<<"Parking fee due: $2.00" << endl;
else (hr-hr >24)

VulpesRank #55 · 29.2K reputationPosted Nov 15, 2012, 4:55 AM EST
I'd therefore suggest you do it on the following lines.
Notice that it's unclear what happens if the car is parked for more than 24 hours. I've assumed the fee is $8 for each day or part thereof. Otherwise, you will have the anomaly that parking for exactly 24 hours costs $10 but for one minute more costs only $8!