I cannot seem to get the total hours and profit up, as when I enter 99 it makes the total_profit and total_hours become 99.
Any help would be appreciated, I've been stuck on this for about 25 minutes.
Here's the basic concept of the code:
Code:
while (hours_parked < 99)
{
cout <<
'\n';
cout <<
"Customer" << '\t' << "Hours" << '\t' << "Charge\n";
cout << counter <<
'\t' << '\t' << hours_parked << '\t' << calculateCharge(hours_parked) << '\n' << '\n';
counter++;
cin >> hours_parked;
cin.get();
}
total_profit = hours_parked * calculateCharge(hours_parked);
total_hours = hours_parked;
cout <<
"Total Hours: " << total_hours << '\n';
cout <<
"Total Profit: " << total_profit << '\n';
system(
"pause");
}