Hey guys im working on a assignment and im stuck at the last part now im not asking you to do it for me im just asking for at least a hint.
now what the assignment says is i should create 2 data members and assignment them the departure time and arrival time now i can do that i just cant seem to figure out how to keep a 2 hour difference between them. here is what they say i need to do.
Departure Time and Arrival Time
Both these will be generated randomly and must have at least difference of two hours in-between departure time and arrival time.
float DepartureTime, ArrivalTime;
DepartureTime = //Your code here for finding a random time;
do
{
ArrivalTime = //Your code here for finding a random time;
} while (ArrivalTime - DepartureTime < 2 hours);
hmm im having a little trouble understanding the while part?... it will assign a random time to arrival time until the difference of arrival time and departure time is less than 2 hours? that doesn't seem right.
please correct me if im wrong.
what i need to do is that i need to keep a 2 hour difference between arrival time and departure time not the diffrence of arrival time and departure time less than 2 hours.
1. Assigns ArrivaleTime a random time.
2. If the difference is less than two hours try assigning a new value..
3. Repeat until the difference is above 2 hours.