case 'f':
case 'F':
  do
{
cout << "Enter Finish Time (Max Start + 24h, 0-23:59): ";
cin >> FinishTime;
						
if (FinishTime > 2359)
{
do
{	cout << "Error! Invalid Finish Time Input." << endl
	     << "Enter Finish Time (Max Start + 24h, 0-23:59): ";
	cin >> FinishTime;
} while (FinishTime > 2359);
}else
if (FinishTime == "q")
{
menu();
}else
if (FinishTime < 2400)
{
									
cout << "Yacht Time: ";
HoursConv(StartTime, FinishTime); 
cout << " hours, Yacht Avg Speed: "
<< AverageSpeed(CourseDistance, StartTime, FinishTime)
<<" knots, " << SpeedConv(AverageSpeed(CourseDistance, StartTime, FinishTime)) << " km/h" << endl;
}
				
}	while (FinishTime != "q" || FinishTime != "Q");		
break;

I can't get my function to call another function if the user input is "q" or "Q". if the user input is a "q" or any other things that aren't a number, the loop goes forever and ever. What I need is when the program asks for a user input in this case in a switch case and the user input is a "q" or "Q", the function will call my menu function and bring up the menu again. If the user input isn't a "q" or "Q", just an ordinary number, then it'll go ahead and calculate everything eg.averagespeed, etc.

Thank you!! It's driving me nuts!

Well since only half of the code is there it's difficult to tell.

My guess is that this is a function called from you menu function.

If so, it may be as simple as

replacing

if (FinishTime == "q")
{
menu();
}

with

if (FinishTime == "q")
{
return NULL;
}

Or something similar

I can't even follow your code. Please learn to use proper and consistent formatting so those you ask help from can read your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.