Hello, I am writing a program for class and I feel I have the code worked out well. However when I try to run the code to see if it works, I cannot get it to "pause". I am using system ("pause");
return 0; just as I had in other codes, but today I cannot figure out what is going on. Any help would be appreciated. Thanks
//validate the menu selection.
while (choice>5)
{
cout << "Please enter a valid menu choice "<<endl;
cin >> choice;
}
if (choice == fast_skier)
{
cout << "The fastest skier is " << fastSkiName << " with a time of " << fastestTime;
switch (choice)
{
case avg_time:
{
const int size = 5;
double SkiTimes[size];
double total = 0;
double avg;
for (int count = 0; count < size; count++)
total += SkiTimes[size];
avg = total / size;
cout << "The average time is " << avg << endl;
}
break;
}
}
} while (choice < 1 || choice>4);
return 0;
}
//*****************************************************************************
///Definition of function showmenu *
//**********************************
void showmenu()
{
cout << "Enter 1 to determine the fastest skier\n"
<< "Enter 2 to calculate the average time\n"
<< "Enter 3 to find the time of a skier\n"
<< "Enter 4 to display the list of skiers\n"
<< "To exit enter any other number ";
}
//***************************************** ******************************
//Definiton of skiNameTime. This is a list of the skiers names and times *
//************************************************************************
Ajenell, please either sort out your code tags or re-post after this with your proper code.
I may have miscounted opening and closing braces, but I doubt if that code will compile. Anyway, put system("pause") at the end of main(), not floating around after a bunch of other routines.