Oct 1, 2015 at 3:28pm UTC
HI. good day sirs.
I have a problem in nested switch-case. the sub menus are not executing/outputting.
first part:
password.
2nd:
>order
*meal
*beverages
>payment
*cash
*credit card/check
>receipt
sub menus for >order and > payment are not working and outputting. BUT my program is running. What will be my problem?
This is a Purchase Order System Project using turbo c 7, "ancient text editor" (just joking)
Using this text editor is a must.
and it do not have the capabilities to copy the code. So, I'm sorry for not typing my code (Its LONGGGG).
Hope anyone see this. Thanks.
sorry for my bad English.
Oct 1, 2015 at 3:50pm UTC
Show us your code or we won't be able to help you
Last edited on Oct 1, 2015 at 3:50pm UTC
Oct 2, 2015 at 12:35pm UTC
OKay SIr.
using turbo c 7. no using namespace std;
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<iomanip.h>
#include<dos.h>
main()
{
clrscr();
int n=12345;
start:
clrscr();
cout<<" ******************************************"<<endl;
cout<<" * *"<<endl;
cout<<" * ENTER PASSWORD *"<<endl;
cout<<" * *"<<endl;
cout<<" ******************************************"<<endl;
cout<<"\n";
cout<<"\n";
cout<<" ---->| "; cin>>n;
switch (n)
{
case 12345:
cout<<"\n\n VALID PASSWORD!!";
delay(500);
goto second;
default:
cout<<"\n\n INVALID PASSWORD!!";
delay(500);
{
clrscr();
cout<<"\n Going ";
delay(500);
cout<<"Back";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
}
{
clrscr();
cout<<"\n Going ";
delay(500);
cout<<"Back";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
}
{
clrscr();
cout<<"\n Going ";
delay(500);
cout<<"Back";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
delay(500);
cout<<".";
goto start;
}
}
second:
char a;
clrscr();
cout<<" ***************************************\n";
cout<<" * *\n";
cout<<" * [A] ORDER *\n";
cout<<" * [B] PAYMENT *\n";
cout<<" * [C] RECEIPT *\n";
cout<<" * *\n";
cout<<" ***************************************\n";
cout<<"\n\n";
cout<<" GO or NOT? [Y/N]\n";
cout<<" ---->| ";
cin>>a;
switch (a)
{
case 'Y':
case 'y':
char b;
clrscr();
cout<<" *****************************************\n";
cout<<" * *\n";
cout<<" * \"ORDER\" *\n";
cout<<" * *\n";
cout<<" *****************************************\n\n\n";
cout<<" [1] MEALS [2] BEVERAGES\n\n";
cout<<" --->| ";
cin>>b;
cout<<endl;
switch (b)
{
case 1:
cout<<" ******************************************\n";
cout<<" * *\n";
cout<<" * \"MEALS\" *\n";
cout<<" * *\n";
cout<<" ******************************************\n\n\n";
cout<<" MENU:\n";
break;
case 2:
cout<<" ******************************************\n";
cout<<" * *\n";
cout<<" * \"BEVERAGES\" *\n";
cout<<" * *\n";
cout<<" ******************************************\n\n\n";
cout<<" MENU:\n";
break;
}
char c;
cout<<" ******************************************\n";
cout<<" * *\n";
cout<<" * \"PAYMENTS\" *\n";
cout<<" * *\n";
cout<<" ******************************************\n\n\n";
cout<<" [1] CASH [2] CREDIT CARDS/CHECKS\n\n";
cout<<" --->| ";
cin>>c;
cout<<endl;
switch(c)
{
case 1:
cout<<"";
break;
case 2:
cout<<"";
break;
}
cout<<" ******************************************\n";
cout<<" * *\n";
cout<<" * \"RECEIPT\" *\n";
cout<<" * *\n";
cout<<" ******************************************\n\n\n";
case 'N':
case 'n':
}
getch();
return(0);
}
this program runs, but the sub menus are not. Hope anyone can help me, this incoming Monday is our deadline. THanks in advance
Last edited on Oct 2, 2015 at 12:39pm UTC
Oct 2, 2015 at 12:36pm UTC
there are some cout errors but I reconstruct in program. The problem is just, sub menus for order and payment doesn't execute
Oct 3, 2015 at 7:47am UTC
UP.....
Need some Info for these. THanksss
Oct 3, 2015 at 1:34pm UTC
http://www.cplusplus.com/forum/beginner/175160/