Hello again ....
I have written a Basic program of an assignment on "Functions" related to a Restaurant Order Booking system.
I am facing following two problems in it :
1- I want to clear screen every time after a user's input so that the Screen related to User's input only show. What should I do to perform it?
2- While selecting Zero (0) to jump back to Main Menu from Sub-Menu, the program works perfect. But after selecting Sub-Menu Card option, the program only shows the Input Option and not reflecting complete Sub-Menu Card option before it. I couldn't understand what I am lacking here ..... !
I am providing the Program Code below and would be thankful if anyone of you point-out the missing error to run the program correctly.
Code:
#include <iostream>
using namespace std;
char mainmenucard (void);
char chinesecuisine(void);
char barbq(void);
char pakistanicuisine(void);
char beverages(void);
char aboveline(void);
char belowline(void);
char nextline(void);
char tabulation2(void);
int main()
{
int mainmenu;
mainmenu = (1,2,3,4);
int submenu;
submenu = (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
int friedrice = 0;
int chickenshashlik = 0;
int thaisoup = 0;
int noodles = 0;
int snacks = 0;
int chickentikka = 0;
int katakut = 0;
int rashmikabab = 0;
int chickenkerhai = 0;
int biryani = 0;
int quorma = 0;
int nan = 0;
int taftan = 0;
int coke = 0;
int sevenup = 0;
int coffee = 0;
int tea = 0;
aboveline();
nextline(); nextline(); nextline();
cout << '\t' << " " << "!..... WELCOME TO THE DELICIOUS FOODS RESTAURANT .....!";
nextline();
mainmenucard();
cin >> mainmenu;
nextline(); nextline();
while (0);
{
if ( mainmenu < 1 || mainmenu > 4 )
{
cout << tabulation2() << "PLEASE INPUT YOUR OPTION FROM MAIN MENU \n"; nextline();
cout << tabulation2() << "1, 2, 3 OR 4 TO CHECK SUB MENU CARD: ";
cin >> mainmenu;
cin.ignore();
nextline(); nextline();
}
if (mainmenu == 1 )
{
chinesecuisine();
}
if (mainmenu == 2 )
{
barbq();
}
if (mainmenu == 3 )
{
pakistanicuisine();
}
if (mainmenu == 4 )
{
beverages();
}
}
while (1)
{
if (submenu == 0)
{
mainmenucard();
cin >> mainmenu;
nextline(); nextline();
}
nextline();
cout << '\t' << "PRESS ZERO ( 0 ) TO RETURN BACK TO MAIN MENU \n";
nextline();
cout << '\t' << "PRESS ( 18 ) TO EXIT AND PRINT YOUR ORDER \n";
nextline();
cout << '\t' << "PLEASE PLACE YOUR ORDER HERE : ";
cin >> submenu;
nextline(); nextline();
if (submenu == 1 )
{
friedrice++;
}
if (submenu == 2 )
{
chickenshashlik++;
}
if (submenu == 3 )
{
thaisoup++;
}
if (submenu == 4 )
{
noodles++;
}
if (submenu == 5 )
{
snacks++;
}
if (submenu == 6 )
{
chickentikka++;
}
if (submenu == 7 )
{
katakut++;
}
if (submenu == 8 )
{
rashmikabab++;
}
if (submenu == 9 )
{
chickenkerhai++;
}
if (submenu == 10 )
{
biryani++;
}
if (submenu == 11 )
{
quorma++;
}
if (submenu == 12 )
{
nan++;
}
if (submenu == 13 )
{
taftan++;
}
if (submenu == 14 )
{
coke++;
}
if (submenu == 15 )
{
sevenup++;
}
if (submenu == 16 )
{
coffee++;
}
if (submenu == 17 )
{
tea++;
}
if (submenu > 18)
{
nextline();
cout << '\t' << "PRESS ZERO ( 0 ) TO RETURN BACK TO MAIN MENU \n";
nextline();
cout << '\t' << "PRESS ( 18 ) TO EXIT AND PRINT YOUR ORDER \n";
nextline();
cout << '\t' << "PLEASE PLACE YOUR ORDER HERE : ";
cin >> submenu;
nextline(); nextline();
}
else if ( submenu == 18 )
{
aboveline();
nextline();nextline();nextline();
cout << '\t' << "YOU ORDERED FOLLOWING FOODS : \n";
nextline(); nextline();
belowline();
cout << '\t'<< "01- Fried Rice :" " " << friedrice << "\n"; nextline();
cout << '\t'<< "02- Chicken Shashlik :" " " << chickenshashlik << "\n"; nextline();
cout << '\t'<< "03- Thai Soup :" " " << thaisoup << "\n"; nextline();
cout << '\t'<< "04- Noodles :" " " << noodles << "\n"; nextline();
cout << '\t'<< "05- Snacks :" " " << snacks << "\n"; nextline();
cout << '\t'<< "06- Chicken Tikka :" " " << chickentikka << "\n"; nextline();
cout << '\t'<< "07- Kata Kut :" " " << katakut << "\n"; nextline();
cout << '\t'<< "08- Rashmi Kabab :" " " << rashmikabab << "\n"; nextline();
cout << '\t'<< "09- Chicken Kerhai :" << chickenkerhai << "\n"; nextline();
cout << '\t'<< "10- Biryani :" " " << biryani << "\n"; nextline();
cout << '\t'<< "11- Qourma :" " " << quorma << "\n"; nextline();
cout << '\t'<< "12- Nan :" " " << nan << "\n"; nextline();
cout << '\t'<< "13- Taftan :" " " << taftan << "\n"; nextline();
cout << '\t'<< "14- Coke : " " " << coke << "\n"; nextline();
cout << '\t'<< "15- 7-Up : " " " << sevenup << "\n"; nextline();
cout << '\t'<< "16- Coffee :" " " << coffee << "\n"; nextline();
cout << '\t'<< "17- Tea : " " " << tea << "\n"; nextline();
belowline();
cout << '\t' << "THANK YOU FOR YOUR ORDER - WE WILL DELIVER IT TO YOU SOON \n";
nextline(); nextline();
break;
}
}
}
char mainmenucard (void)
{
aboveline();
nextline(); nextline(); nextline();nextline();
cout << tabulation2() << tabulation2() << "'MAIN MENU CARD \n";
cout << tabulation2() << tabulation2() << " ______________ \n";
nextline(); nextline();
cout << tabulation2() << " I T E M S \n";
cout << tabulation2() << " _________ \n";
nextline(); nextline(); nextline();
cout << tabulation2() << "1- CHINESE CUISINE \n";
nextline();nextline();
cout << tabulation2() << "2- BAR B-Q \n";
nextline();nextline();
cout << tabulation2() << "3- PAKISTANIS CUISINE \n";
nextline(); nextline();
cout << tabulation2() << "4- BEVERAGES \n";
nextline(); nextline();
belowline();
cout << tabulation2() << "PLEASE INPUT YOUR OPTION 1, 2, 3 OR 4 \n"; nextline();
cout << tabulation2() << "FROM MAIN MENU TO CHECK SUB MENU CARD: ";
}
char nextline(void)
{
cout << '\n';
}
char tabulation2()
{
cout << '\t' << '\t';
}
char aboveline()
{
nextline(); nextline();
cout << '\t' << " *************************************************************** ";
}
char belowline ()
{
cout << '\t' << " *************************************************************** ";
nextline(); nextline();
}
char chinesecuisine()
{
aboveline();
nextline(); nextline();
cout << tabulation2() << "I- CHINESE CUISINE \n";
cout << tabulation2() << "__________________ \n";
nextline();
cout << tabulation2() << "1- Fried Rice \n";
nextline();
cout << tabulation2() << "2- Chicken Shashlik \n";
nextline();
cout << tabulation2() << "3- Thai Soup \n";
nextline();
cout << tabulation2() << "4- Noodles \n";
nextline();
cout << tabulation2() << "5- Snacks \n";
nextline(); belowline();
}
char barbq()
{
aboveline();
nextline(); nextline();
cout << tabulation2() << "II- BAR B-Q \n";
cout << tabulation2() << "__________ \n";
nextline();
cout << tabulation2() << "6- Chicken Tikka \n";
nextline();
cout << tabulation2() << "7- Kata Kut \n";
nextline();
cout << tabulation2() << "8- Rashmi Kabab \n";
nextline();
cout << belowline();
}
char pakistanicuisine()
{
aboveline();
nextline(); nextline();
cout << tabulation2() << "III- PAKISTANIS CUISINE \n";
cout << tabulation2() << "_______________________ \n";
nextline();
cout << tabulation2() << "9- Chicken Kerhai \n";
nextline();
cout << tabulation2() << "10- Biryani \n";
nextline();
cout << tabulation2() << "11- Qourma \n";
nextline();
cout << tabulation2() << "12- Nan \n";
nextline();
cout << tabulation2() << "13- Taftan \n";
nextline();
belowline();
}
char beverages()
{
aboveline();
nextline(); nextline();
cout << tabulation2() << "IV- BEVERAGES \n";
cout << tabulation2() << "_____________ \n";
nextline();
cout << tabulation2() << "14- Coke \n";
nextline();
cout << tabulation2() << "15- 7-Up \n";
nextline();
cout << tabulation2() << "16- Coffee \n";
nextline();
cout << tabulation2()<< "17- Tea \n";
nextline();
belowline();
}