//A c++ program that calculate and print parking charges
#include <iostream>
using namespace std;
#include <iomanip>

const double minimumFee       = 7.00;
const double hourlyFee    = 1.75;
const int    numOfCustomers   = 2;
const int    numOfMinsPerHour = 60;

void inputAndValidate(int,int,int,int);
void convertToMinutes(int&,int&,int&,int&);
void convertBackToTime(int&);
double calcCharge(int&,int&,double);

int entranceMinutes,exitMinutes,entranceTimeInMins,exitTimeInMins ;
int minutesParked,parkedMinutes,entranceHour,exitHour,parkedTime ;
int parkedHours;
double charge;

int main()
{
	//int numbOfCustomers = 0;
	cout<<"Customer"<<setw(10)<<"Entry Time"<<setw(10)<<"Exit Time"<<setw(10)<<"Parked Time"<<setw(10)<<"Charge"<<endl;
	for (int num = 1; num <= numOfCustomers; num++ )
	{
		inputAndValidate(entranceHour,entranceMinutes,exitHour,exitMinutes);
		convertToMinutes(entranceHour,entranceMinutes,exitHour,exitMinutes);
		convertBackToTime(minutesParked);
		
		cout<<num<<setw(5)<<entranceHour<<"h"<<entranceMinutes<<setw(5)<<exitHour<<"h"
			<<exitMinutes<<setw(5)<<parkedTime<<setw(5)<<calcCharge(parkedMinutes,
			parkedHours,charge)<<endl;
	}
		return 0;
}
void inputAndValidate (int entranceHour,int exitHour,int entranceMinutes,int exitMinutes)
{
	//if(numOfCustomers <= 2){
	do{
		//if(numbOfCustomers <= 2)
		cout<<"Input the time you entered the garage"<<endl;
		if(entranceHour = 24)
			entranceMinutes = 00;
		cin>>entranceHour >> entranceMinutes;
		cout<<"input the time you left the garage"<<endl;
		if(exitHour = 24)
			exitMinutes =00;
		cin>>exitHour >> exitMinutes;
		if((entranceHour<0 && exitHour >= 24) && (entranceMinutes<=0 && exitMinutes >=59))
			cout<<"Input the valid time"<<endl;
	
	}while((entranceHour>0 && exitHour <= 24) && (entranceMinutes>=0 && exitMinutes <=59));
}
		
void convertToMinutes(int& entranceHour,int& exitHour,int& entranceMinutes,int& exitMinutes)
{
	int entraceTimeInMins = (entranceHour * numOfMinsPerHour + entranceMinutes);
	int exitTimeInMins = (exitHour * numOfMinsPerHour + exitMinutes);
	int minutesParked = (exitMinutes - entranceMinutes);
}
void convertBackToTime(int& minutesParked)
{
	int parkedHours = (minutesParked / numOfMinsPerHour);
    int parkedMinutes = (minutesParked % numOfMinsPerHour);
	int parkedTime = (parkedHours , parkedMinutes);
}
double calcCharge(int& parkedHours ,int& parkedMinutes ,double charge)
{ 
	if ((parkedHours>=3 && parkedHours<=24) && (parkedHours>0 && parkedMinutes<=60)){
		
		int additionalHourMin = (parkedHours - 2);
		double charge = (additionalHourMin * hourlyFee + minimumFee);
	    return charge;
	}
	else
		if((parkedHours>=3 && parkedHours<=24) && (parkedMinutes == 0)){
			int additionalHours = (parkedHours - 3);
			double charge = (additionalHours * hourlyFee + minimumFee);
			return charge;
		}
		return 0;
}

this program does not interact with main function in a proper way,PLZ HELP GUYS

>> this program does not interact with main function in a proper way

  1. What does the program actually do?
  2. What does the program do?
  3. How do these differ? (i.e. what is the precise problem?)

I'm guessing the problem is here?

void inputAndValidate (int entranceHour,int exitHour,int entranceMinutes,int exitMinutes)

Are you sure you want to pass by value instead of by reference? I'm seeing input being read into local variables, then apparently thrown away, then you attempt to use those no-longer-existent values in main to do calculations. I'm guess you want to pass these variables by reference, not value.

You have many errors in your code, the loop ending is just one of them.

In order for the loop to end the way it is right now the person has to enter numbers out of range. A while loop will go for as long as the condition is met. In this case the condition is when the user puts in valid numbers (so change the condition in the loop to catch bad input).

You are passing variables into inputAndValidate() by value and returning nothing, this means that this function does nothing. To fix this pass values in by reference inputAndValidate(int&, int&, int&) similar to what you have already for other functions that also do nothing.

Both functions convertToMinutes() and convertBackToTime() pass values by reference but do not modify them at all. These functions make variables, return nothing and do nothing.

The calcCharge() function does not need to pass any values by reference and you do not need to pass the variable charge into it since you are returning a double.

I would recommend commenting out each function in main() and getting them to work as intended one by one, then getting them to work together.

This question has already been answered. Start a new discussion instead.