If I run my program I keep on getting the same results where I am supposed to get 2 different results. I know the problem is in my second function but I cannot find it. Please help me.
//
#include <iostream>
using namespace std;
const int NUM_CUSTOMERS = 10;
const int NUM_MINUTES = 60;
const float MIN_FEE = 7.00;
const float HOUR_FEE = 1.50;
const int CUT_OFF_TIME = 180;
//First function
void inputAndValidate(int & entranceHour, int & entranceMinutes,
int & exitHour, int & exitMinutes)
{
cout << "Enter entrance time(hours folowed by minutes in 24h00 format) : ";
cin >> entranceHour >> entranceMinutes;
cout << "Enter exit time(hours followed by minutes in 24h00 format) : ";
cin >> exitHour >> exitMinutes;
while(exitHour > 24 || exitMinutes > 59)
{
cout << "ERROR: Please enter again : ";
cin >> exitHour >> exitMinutes;
}
}
//Second funtion
int convertToMinutes(int entranceHour, int entranceMinutes,
int exitHour, int exitMinutes)
{
int entranceTimeInMins = 0;
int exitTimeInMins = 0;
//Third function
void displayMinutes(int entranceTimeInMins, int exitTimeInMins)
{
cout << "Entrance time in mins is " << entranceTimeInMins << endl;
cout << "Exit time in mins is " << exitTimeInMins << endl;
}
int main( )
{
int entranceHour, entranceMinutes;
int exitHour, exitMinutes;
int entranceTimeInMins, exitTimeInMins;
Please can you get me on the right track and how many return statements should there be and should it be on the very end of the function? Thanx that you are willing to help me, I appreicaite
1. you can picture function's return's as a result or output or outcome, so when a function is declared like this: int addNumber(int a, int b); you should design it so that it returns an integer e.g
1 2 3 4 5 6
{ //in addNumber's body
return a + b;
//or to be more explicit
c=a+b;
return c;
}
2. in C++ '=' and '==' mean different things,
the '=' is an assignment operator (or, 'put a value into') thus, int a=6 means put a value of '6' into 'a',
while the '==' operator is used to compare one value to another i.e a == 6 means: see if a and 6 is of the same value
and this is for further reading (or reminder) -look for para. "Relational and equality operators ( ==, !=, >, <, >=, <= )": http://www.cplusplus.com/doc/tutorial/operators/