Y
YitzHandel
The following is an extract from my program, which I seperated out and
compiled as its own program.
The problem is that as soon as a case tests true, all the cases below
it execute as well. So if the user inputs, 4, the statements from
cases 4-9 will execute.
(I replaced function calls with cout for testing.)
I am using Win2k, Open Watcom IDE v 1.3.
This has tested as happening in several places in the program.
(p.s. - it compiles as is, it also compliles fine with all the
commented out libraries - same error either way)
//#include <stdio.h>
#include <stdlib.h>
#include <iostream.h> // instead of using namespace std
//#include <string.hpp>
//#include <fstream.h>
//#include <istream>
//#include "Fcopy.h"
//#include <ctime>
//#include <math.h>
int main ()
{
int menu_select_int =-1;
do
{
system("CLS");
cout <<"**********************MENU***********************\n";
cout << " Create Or Edit Input File..........1\n";
cout << " Calc. no. of stages................2\n";
cout << " Data plot..........................3\n";
cout << " RR vs. No. Of stages...............4\n";
cout << " McCabe Thiele plot.................5\n";
cout << " Printout the input file............6\n";
cout << " Printout of the tray compositions..7\n";
cout << " Printout of the vle data...........8\n";
cout << " Quit...............................9\n";
cout << "*************************************************\n\n";
cout << "MENU: ";
cin >> menu_select_int;
switch (menu_select_int)
{
case 1:
cout << "\ngoing to input data function\n";
cout << "case 1";
cin.ignore();
case 2:
cout << "\ngoing to CNOS function\n";
cout << "case 2";
cin.ignore();
case 3:
cout << "\ngoing to DP function\n";
cout << "case 3";
cin.ignore();
case 4:
cout << "\ngoing to RR vs function\n";
cout << "case 4";
cin.ignore();
case 5:
cout << "\ngoing to McTh function\n";
cout << "case 5";
cin.ignore();
case 6:
cout << "\ngoing to PIF function\n";
cout << "case 6";
cin.ignore();
case 7:
cout << "\ngoing to printout function\n";
cout << "case 7";
cin.ignore();
case 8:
cout << "\ngoing to PO VLE function\n";
cout << "case 8";
cin.ignore();
case 9:
cout << "\ngoing to AYS - end function\n";
cout << "case 9";
cin.ignore();
} //end switch case
} while (menu_select_int != 9);
cin.ignore();
return(0);
}
compiled as its own program.
The problem is that as soon as a case tests true, all the cases below
it execute as well. So if the user inputs, 4, the statements from
cases 4-9 will execute.
(I replaced function calls with cout for testing.)
I am using Win2k, Open Watcom IDE v 1.3.
This has tested as happening in several places in the program.
(p.s. - it compiles as is, it also compliles fine with all the
commented out libraries - same error either way)
//#include <stdio.h>
#include <stdlib.h>
#include <iostream.h> // instead of using namespace std
//#include <string.hpp>
//#include <fstream.h>
//#include <istream>
//#include "Fcopy.h"
//#include <ctime>
//#include <math.h>
int main ()
{
int menu_select_int =-1;
do
{
system("CLS");
cout <<"**********************MENU***********************\n";
cout << " Create Or Edit Input File..........1\n";
cout << " Calc. no. of stages................2\n";
cout << " Data plot..........................3\n";
cout << " RR vs. No. Of stages...............4\n";
cout << " McCabe Thiele plot.................5\n";
cout << " Printout the input file............6\n";
cout << " Printout of the tray compositions..7\n";
cout << " Printout of the vle data...........8\n";
cout << " Quit...............................9\n";
cout << "*************************************************\n\n";
cout << "MENU: ";
cin >> menu_select_int;
switch (menu_select_int)
{
case 1:
cout << "\ngoing to input data function\n";
cout << "case 1";
cin.ignore();
case 2:
cout << "\ngoing to CNOS function\n";
cout << "case 2";
cin.ignore();
case 3:
cout << "\ngoing to DP function\n";
cout << "case 3";
cin.ignore();
case 4:
cout << "\ngoing to RR vs function\n";
cout << "case 4";
cin.ignore();
case 5:
cout << "\ngoing to McTh function\n";
cout << "case 5";
cin.ignore();
case 6:
cout << "\ngoing to PIF function\n";
cout << "case 6";
cin.ignore();
case 7:
cout << "\ngoing to printout function\n";
cout << "case 7";
cin.ignore();
case 8:
cout << "\ngoing to PO VLE function\n";
cout << "case 8";
cin.ignore();
case 9:
cout << "\ngoing to AYS - end function\n";
cout << "case 9";
cin.ignore();
} //end switch case
} while (menu_select_int != 9);
cin.ignore();
return(0);
}