Well, apparently, I jumped the gun a little.
My code for the program I wrote still doesn't work.
It compiles fine and throws no errors, but when I run it, only my main menu list runs-- over and over, regardless of my input, and the esc key no longer works.
I have a list of three options.
1- func_A
2- func_B
3- func_C
I've used switch up until now, and as stated previously, it ran fine. This evening I tried multiple nested if else if statements, and obtained the same issue. My console run just output my primary menu-- over and over again, regardless of my input.
Below is my code.
float hipvalley(float argc, char *argv[]);
float cricketvalley(float argc, char *argv[]);
float ridgeangle(float argc, char *argv[]);
//I've tried other terms within the parenthesis for the above functions, and
// a variety of errors are thrown. They are briefly discussed below.
int _tmain(int argc, _TCHAR* argv[])
{
do
{
cout << "Copyright 2001, Welcome to the Angle Finder Program." << endl;
cout << "This program is designed to take only numeric values." << endl;
cout << "Make certain you only input numbers. Otherwise it will exit." << endl;
cout << " Please choose: 1 for the Hip/Valley Angle. "<< endl;
cout << " 2 for the Cricket Valley Angle. " << endl;
cout << " 3 for the Ridge Angle " << endl;
cout << " ESC to exit. "<< endl;
ch = getchar();
switch (ch)
{
case 1 : float hipvalley(); // this is the Hip/Valley choice.
break;
//first run through resulted in the program
// just repeating the same intro language
// over and over again, regardless of my input.
//Find out what's needed to make this switch
//statement work in here.
// same issue after 20 or 30 runs. repeated intro menu...regardless
// of input.
case 2 : float cricketvalley(); // this is the cricket valley choice.
break;
case 3 : float ridgeangle(); // this is the Ridge Angle choice.
if (ch != 27) cout << " Sorry, that is not a valid choice! " << endl;
}
} while (ch != 27);
return(0);
What am I missing here?
At this point, I'm honestly thinking there is something wrong with how I've defined my functions above-- hipvalley(), cricketvalley(), and ridgeangle().
I did just change the contents within the () to (void), from (float argc, char *argv[]), and received the same results. repeating main menu.
I changed the float to int, and same result.
I then removed int entirely from all occurrences, and got errors-- same as before-- C++ cannot assume int......
So, I've replaced int in front of the functions, and got the same results as listed above-- my main menu is the only output.
Any help is deeply appreciated.
Best.