You do need two pieces of data from the user: start-time and duration. Now you only ask for duration. With start-time you can calculate how much is in the day and how much in the night.
1) Please use code tags when posting code here, to make it readable.
2) We're not interested in silly guessing games. If you you have a problem, tell us what it is. If you're getting error messages, tell us what they are and where they are. What possible reason could you have for withholding this information, unless it's to jerk us around?
any good suggestion better 1?
#include <iostream>
using namespace std;
int main ()
{
int hours,charges,total,vehicles,time;
int first = 3;
int second = 2;
int subsequent = 1;
vehicles = 0;
total = 0;
charges = 0;
sorry newbie here..Not really how to use it..
If I write as above still got the logical problem?
or got any code better for suggestion?
sorry for my poor English!
What is the purpose of the if-condition on line 5? Oh, wait, I know: the user loves to park at -7 o'clock. But if so, then he should be instructed to use standard time.
How do you take into account that I did park my car at 17:00, spending only the first hour within the 6-18 period? How could you calculate it?