S
SteveDB1
Hi all.
I'm using VS 2008 Express C++.
I created a console application back in 1999, and updated it for VC++ 6.0 in
2001.
I've updated again this past month, and have found enough differences that I
now need to use a different exit routine.
In 2001, I could use a basic escape with a do {}while(ch!= 27);
Now that apparently does not work.
So, how do I exit a function now with C++ 2008 express?
My general form is:
------------------------------------------------------------------
# include "stdafx.h"
# include <iostream>
# include <cmath>
# include <xutility>
# include <stdlib.h>
# include <cctype>
# include <conio.h>
# define PI 3.1415926535898
int n;
int ParA, ParB, ParC, ParD, ParE;
using namespace std;
int functionA (int& ParA, int& ParB, int& ParC, int& ParD)
//ParA through ParE are parameters/variables (please pardon me if I
//incorrectly stated the terms) within my functions.
{
secondary menu to explain how to use this function-A.
do
{
core code for this function.
} while (ch_n != 27);
//return n; //where n is an equation within the core code.
exit(0);
}
int functionB (int& ParA, int& ParB, int& ParC, int& ParD, int& ParE);
secondary menu to explain how to use this function-B.
do
{
core code for this function.
} while (ch_(n+1) != 27);
//the "ch_(n+1) is a character subscript I used for my while escape.
//return n; //where n is an equation within the core code.
exit(0); //this does not work to exit my functions.
}
int functionC (int& ParA, int& ParB);
secondary menu to explain how to use this function-C.
do
{
core code for this function.
} while (ch_(n+2) != 27);
//return n; //where n is an equation within the core code.
exit(0);
}
int main()
{
Do
{
main welcome menu which gives options to access my functions,
or exit the program.
Switch(ch)
{
case '1' : functionA(ParA, ParB, ParC, ParD);
break;
case '2' : functionB(ParA, ParB, ParC, ParD, ParE);
break;
case '3' : functionC(ParA, ParB);
break;
default : exit(0);
}
} while (ch != 27);
}
I'm using VS 2008 Express C++.
I created a console application back in 1999, and updated it for VC++ 6.0 in
2001.
I've updated again this past month, and have found enough differences that I
now need to use a different exit routine.
In 2001, I could use a basic escape with a do {}while(ch!= 27);
Now that apparently does not work.
So, how do I exit a function now with C++ 2008 express?
My general form is:
------------------------------------------------------------------
# include "stdafx.h"
# include <iostream>
# include <cmath>
# include <xutility>
# include <stdlib.h>
# include <cctype>
# include <conio.h>
# define PI 3.1415926535898
int n;
int ParA, ParB, ParC, ParD, ParE;
using namespace std;
int functionA (int& ParA, int& ParB, int& ParC, int& ParD)
//ParA through ParE are parameters/variables (please pardon me if I
//incorrectly stated the terms) within my functions.
{
secondary menu to explain how to use this function-A.
do
{
core code for this function.
} while (ch_n != 27);
//return n; //where n is an equation within the core code.
exit(0);
}
int functionB (int& ParA, int& ParB, int& ParC, int& ParD, int& ParE);
secondary menu to explain how to use this function-B.
do
{
core code for this function.
} while (ch_(n+1) != 27);
//the "ch_(n+1) is a character subscript I used for my while escape.
//return n; //where n is an equation within the core code.
exit(0); //this does not work to exit my functions.
}
int functionC (int& ParA, int& ParB);
secondary menu to explain how to use this function-C.
do
{
core code for this function.
} while (ch_(n+2) != 27);
//return n; //where n is an equation within the core code.
exit(0);
}
int main()
{
Do
{
main welcome menu which gives options to access my functions,
or exit the program.
Switch(ch)
{
case '1' : functionA(ParA, ParB, ParC, ParD);
break;
case '2' : functionB(ParA, ParB, ParC, ParD, ParE);
break;
case '3' : functionC(ParA, ParB);
break;
default : exit(0);
}
} while (ch != 27);
}