Hi all.
A while back I'd posted regarding a do-while routine, using switch.
It appears that my main is working, and my switch.... it just keeps looping around my main menu.
I'm not entirely clear on why either.
Here is the code.
(One responder to a previous post told me that my indenting sucked, I've done a preview, and it looked good when I posted. It if screws up, please accept my apologies. I did try...)
# include "stdafx.h"
# include <iostream>
# include <cmath>
# include <xutility>
# include <stdlib.h>
# include <cctype>
# include <conio.h>
# define PI 3.1415926535898
using namespace std;
char ch;
//I've tried both int, and char, as well as with
//single quotes within my switch, for char ch and without
//the single quotes for int ch.
int main(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 << "0 to exit. "<< endl;
cin >> ch;
switch (ch)
{
case '1' : int HipValley(int& Rise1, int& Rise2, double& Eave, float& a);
// this is the Hip/Valley choice.
break;
case '2' : int CricketValley(int& Rise1, int& Rise2, double& Eave, float& a, float& Width);
// this is the cricket valley choice.
break;
case '3' : int RidgeAngle(int& Rise1, int& Rise2);
//this is the Ridge Angle choice.
break;
default : return 0; // this will end the routine.
}
}while (ch != 27);
return 0;
}
I get no errors, it compiles fine, but it just loops the main menu over and over until I enter 0.