Opening one of my vaults
This is positively one of my first pieces of code. I remember coding this using my mom's laptop on a Sunday morning. I was so excited when it compiled that I remember bugging my then CS professor to see this masterpiece! There are
some golden moments I found in this code: windows-based libraries, no use of
loops (
except for a single goto statement) and tons of hard-coding.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int ch0,ch1,ch2,ch3,ch4,ch5,ch6,ch7,ch8,ch9,ch10,ch11,ch12,ch13,ch14,ch15,ch16,ch17,ch18,ch19,ch20,ch21,ch22;
char nm[30],cn[20],addr[75],nadd[75],pin[15];
double total; total=0;
long cuc;
cout<<"WELCOME TO MCDONALD'S"<<endl;
cout<<"This Program Helps You To Place Your Order"<<endl;
cout<<"For Any Further Informtion Log On To OurSite www.mcdonalds.co.in"<<endl;
cout<<""<<endl;cout<<""<<endl;
cout<<"Enter Your Region Code To Track Your Location And Place The Order - ";
cin.getline(pin,15);endl;cout<<""<<endl;
cout<<"Enter Your Name - ";
cin.getline(nm,30);endl;cout<<""<<endl;
cout<<"Enter Your Contact Number - ";
cin.getline(cn,20);endl;cout<<""<<endl;
cout<<"Enter Your Home Address - ";
cin.getline(addr,75);endl;cout<<""<<endl;
cout<<"Do You Want Us To Not Add Any Specific Item In Your Food?"<<endl;
cout<<"If Yes Mention It Below, Else Press Enter Key To Continue."<<endl;
cout<<"- ";cin.getline(nadd,75);endl;
cout<<""<<endl;
cout<<"Do You Want To Cash In Your McDonald's Vouchers (If Any) - ";
cout<<"1. Yes 2. No"<<endl;
cin>>ch1;cout<<""<<endl;
if(ch1==1)
{ cout<<"Enter Your Cupon Code - ";
cin>>cuc;cout<<""<<endl;
if(cuc>=1000 && cuc<=3000)
total=total-25;
else if(cuc>3000 && cuc<=6500)
total=total-35;
else if(cuc>6500 && cuc<=9999)
total=total-50;
else if(cuc<1000 && cuc>10000)
cout<<"Invalid Cupon Code"<<endl;
}
{ abc:
cout<<"Enter The Category Of Food You Wish To Order"<<endl;
cout<<"1.Vegetarian 2.Non Vegetarian"<<endl;
cout<<"3.Happy Meals 4.Desserts"<<endl;
cout<<"5.Value Meals 6.Extras And Dips"<<endl;
cin>>ch2;cout<<""<<endl;
{
if(ch2==1)
{cout<<"The Categories Available Are:"<<endl;
cout<<"1.Burgers 2.Rolls"<<endl;
cout<<"3.Sides 4.Smoothies"<<endl;
cin>>ch3;cout<<""<<endl;
if(ch3==1)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Mc Aloo Tikka - Rs.33.21"<<endl;
cout<<"2.Mc Veggie - Rs.79.01"<<endl;
cout<<"3.Mc Spicy Paneer - Rs.129.21"<<endl;
cout<<"4.Indy Mc Paneer - Rs.159.29"<<endl;
cin>>ch4;cout<<""<<endl;
{if(ch4==1)
total=total+33.21;
else if(ch4==2)
total=total+79.01;
else if(ch4==3)
total=total+129.21;
else if(ch4==4)
total=total+159.29;
}}
if(ch3==2)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Big Spicy Paneer Wrap - Rs.170.61 "<<endl;
cout<<"2.Salad Wrap - Rs.92.75"<<endl;
cout<<"3.Saucy Wraps - Rs.57.25"<<endl;
cin>>ch5;cout<<""<<endl;
{if(ch5==1)
total=total+170.61;
else if(ch5==2)
total=total+92.75;
else if(ch5==3)
total=total+57.25;
}}
if(ch3==3)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.French Fries - Rs.58.40"<<endl;
cout<<"2.Pizza McPuff - Rs.28.63"<<endl;
cout<<"3.Chilli Paneer Pockets - Rs.40.08"<<endl;
cin>>ch6;cout<<""<<endl;
{if(ch6==1)
total=total+58.40;
else if(ch6==2)
total=total+28.63;
else if(ch6==3)
total=total+40.08;
}}
if(ch3==4)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Smoothie - Rs.194.65"<<endl;
cout<<"2.Double Choclate Frappe - Rs.188.93"<<endl;
cout<<"3.McCafe Frappe - Rs.160.30"<<endl;
cout<<"4.McCafe Classic Coffe - Rs.148.85"<<endl;
cout<<"5.McCafe Ice Tea - Rs.114.50"<<endl;
cin>>ch7;cout<<""<<endl;
{if(ch7==1)
total=total+194.65;
else if(ch7==2)
total=total+188.93;
else if(ch7==3)
total=total+160.30;
else if(ch7==4)
total=total+148.85;
else if(ch7==5)
total=total+114.50;
}}
}
else if(ch2==2)
{cout<<"The Categories Are As Follows:"<<endl;
cout<<"1.Burgers 2.Rolls"<<endl;
cout<<"3.Fries 4.Smoothies"<<endl;
cin>>ch8;cout<<""<<endl;
if(ch8==1)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Chicken McGrill - Rs.50.38"<<endl;
cout<<"2.McChicken - Rs.91.60"<<endl;
cout<<"3.Filet-O-Fish - Rs.113.36"<<endl;
cout<<"4.McSpicy Chicken - Rs.133.97"<<endl;
cin>>ch9;cout<<""<<endl;
{if(ch9==1)
total=total+50.38;
else if(ch9==2)
total=total+91.60;
else if(ch9==3)
total=total+113.36;
else if(ch9==4)
total=total+133.97;
}}
if(ch8==2)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Big Spicy Chicken Wrap - Rs.170.61"<<endl;
cout<<"2.Saucy Wraps - Rs.57.25"<<endl;
cin>>ch10;cout<<""<<endl;
{if(ch10==1)
total=total+170.61;
else if(ch10==2)
total=total+57.25;
}}
if(ch8==3)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.McWings - Rs.67.27"<<endl;
cout<<"1.Non Veg Dip - Rs.22.90"<<endl;
cin>>ch11;cout<<""<<endl;
{if(ch11==1)
total=total+67.27;
else if(ch11==2)
total=total+22.90;
}}
if(ch8==4)
{cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Smoothie - Rs.194.65"<<endl;
cout<<"2.Double Choclate Frappe - Rs.188.93"<<endl;
cout<<"3.McCafe Frappe - Rs.160.30"<<endl;
cout<<"4.McCafe Classic Coffe - Rs.148.85"<<endl;
cout<<"5.McCafe Ice Tea - Rs.114.50"<<endl;
cin>>ch12;cout<<""<<endl;
{if(ch12==1)
total=total+194.65;
else if(ch12==2)
total=total+188.93;
else if(ch12==3)
total=total+160.30;
else if(ch12==4)
total=total+148.85;
else if(ch12==5)
total=total+114.50;
}}
}
else if(ch2==3)
{cout<<"1.Veg Happy Meal 2.Non Veg Happy Meal"<<endl;
cin>>ch15;cout<<""<<endl;
if(ch15==1)
{cout<<"Each Happy Meal Is Provided With Fanta And A Toy"<<endl;
cout<<"The Toy Of The Day Is - BUZZ LIGHTYEAR'S ACTION FIGURE"<<endl;
cout<<"The Menu Is As Follows"<<endl;
cout<<"1.McVeggie - Rs.135.67"<<endl;
cout<<"2.Pizza McPuff - Rs.119.64"<<endl;
cout<<"3.McAloo Tikka - Rs.119.64"<<endl;
cin>>ch16;cout<<""<<endl;
{if(ch16==1)
total=total+135.67;
else if(ch16==2)
total=total+119.64;
else if(ch16==3)
total=total+119.64;
}}
else if(ch15==2)
{cout<<"Each Happy Meal Is Provided With Fanta And A Toy"<<endl;
cout<<"The Toy Of The Day Is - BUZZ LIGHTYEAR'S ACTION FIGURE"<<endl;
cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Chicken McNuggets - Rs.135.67"<<endl;
cout<<"2.Mc Chicken - Rs.135.67"<<endl;
cout<<"3.Chicken McGrill - Rs.119.64"<<endl;
cin>>ch18;cout<<""<<endl;
{if(ch18==1)
total=total+135.67;
else if(ch18==2)
total=total+135.67;
else if(ch18==3)
total=total+119.64;
}}
}
else if(ch2==4)
{
cout<<"The Dessert Menu Is As Follows"<<endl;
cout<<"1.Brownie With Hot Fudge - Rs.80.15"<<endl;
cout<<"2.McFlurry Brownie - Rs.76.72"<<endl;
cout<<"3.Soft Serve Hot Fudge - Rs.61.83"<<endl;
cout<<"4.Soft Serve Strawberry - Rs.61.83"<<endl;
cout<<"5.McFlurry Oreo - Rs.56.11"<<endl;
cin>>ch17;cout<<""<<endl;
{if(ch17==1)
total=total+80.15;
else if(ch17==2)
total=total+76.72;
else if(ch17==3)
total=total+61.83;
else if(ch17==4)
total=total+61.83;
else if(ch17==5)
total=total+56.11;
}}
else if(ch2==5)
{cout<<"1.Veg Value Meal 2.Non Veg Value Meal"<<endl;
cin>>ch19;cout<<""<<endl;
if(ch19==1)
{cout<<"Each Value Meal Is Provided With Coke and Large Fries"<<endl;
cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Big Spicy Paneer - Rs.238.16"<<endl;
cout<<"2.Indy McSpicy Paneer - Rs.222.13"<<endl;
cout<<"3.McSpicy Paneer - Rs.217.55"<<endl;
cout<<"4.Salad Wrap - Rs.194.65"<<endl;
cout<<"5.McAloo Wrap - Rs.123.66"<<endl;
cin>>ch20;cout<<""<<endl;
{if(ch20==1)
total=total+238.16;
else if(ch20==2)
total=total+222.13;
else if(ch20==3)
total=total+217.55;
else if(ch20==4)
total=total+194.65;
else if(ch20==5)
total=total+123.66;
}}
else if(ch19==2)
{cout<<"Each Value Meal Is Provided With Coke and Large Fries"<<endl;
cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Big Spicy Chicken - Rs.240.45"<<endl;
cout<<"2.Indy McSpicy Chicken - Rs.223.28"<<endl;
cout<<"3.McSpicy Chicken - Rs.222.13"<<endl;
cout<<"4.Chicken Grill Wrap - Rs.135.11"<<endl;
cout<<"5.Egg Wrap - Rs.123.66"<<endl;
cin>>ch21;cout<<""<<endl;
{if(ch21==1)
total=total+240.45;
else if(ch21==2)
total=total+223.28;
else if(ch21==3)
total=total+222.13;
else if(ch21==4)
total=total+135.11;
else if(ch21==5)
total=total+123.66;
}}
}
else if(ch2==6)
{
cout<<"The Menu Is As Follows"<<endl;
cout<<"1.Veg Dips - Rs.15.00"<<endl;
cout<<"2.Piri Piri - Rs.15.00"<<endl;
cout<<"3.Extra Cheese (only on 1 item) - Rs.25.00"<<endl;
cout<<"4.Extra Paneer (only on 1 item) - Rs.25.00"<<endl;
cout<<"5.Extra Chicken (only on 1 item) - Rs.40.00"<<endl;
cin>>ch22;cout<<""<<endl;
{if(ch22==1)
total=total+15.00;
else if(ch22==2)
total=total+15.00;
else if(ch22==3)
total=total+25.00;
else if(ch22==4)
total=total+25.00;
else if(ch22==5)
total=total+40.00;
}}
}
cout<<"Do You Wish To Order Something More:";
cout<<" 1.Yes 2.No"<<endl;
cin>>ch13;cout<<""<<endl;
{if(ch13==1)
goto abc; }
}
clrscr();
cout<<"Name Of The User - "<<nm<<endl;
cout<<"Contact No. - "<<cn<<endl;
cout<<"Delivery Address - "<<addr<<endl;
cout<<"Region Code - "<<pin<<endl;
{
if(ch1==1)
cout<<"Cupon Code: - "<<cuc<<endl;
}
cout<<"Total Bill - Rs."<<total<<endl;cout<<""<<endl;cout<<""<<endl;
{
if(total<150)
{cout<<"Sorry But A Minimum Bill Of Rs.150 Is Required To Provide You A Home Service"<<endl; }
else if(total>=150)
{cout<<"As Per Our Red Hot Delivery System You Will Receive Your Food Within An Hour"<<endl;}
}
cout<<""<<endl;
if(total>=200)
{
cout<<"For Purchasing Food Above Rs.200 We Give You Free Voucher Worth Rs.35"<<endl;
cout<<"You Can Redeem These Voucher The Next Time You Visit Our Site"<<endl;
cout<<"Your Voucher Code Is : 3113"<<endl;
}
cout<<""<<endl;cout<<""<<endl;
cout<<"Was This Site helpful:-"<<endl;
cout<<"1.Very Helpful"<<endl;
cout<<"2.Unsatisfactory"<<endl;
cin>>ch14;cout<<""<<endl;
{
if(ch14==1)
{cout<<"Thank You For Your Review"<<endl;}
else if(ch14==2)
{cout<<"Kindly Mention Your Problem, if any:"<<endl;
cout<<"On Our Toll Free No. 0220222202"<<endl;
}
else
{clrscr();}
}
if(ch14==2)
{cout<<"Thank You For Your Review"<<endl;}
cout<<""<<endl;
cout<<"Thank You For Choosing McDonalds"<<endl;
cout<<"We Hope You Enjoy Your Meal"<<endl;
cout<<"For Any Further Complaints/Inquiries Log On To www.mcdonalds.co.in"<<endl;
cout<<"MCDONALD'S - I'M LOVIN IT!!!"<<endl;
getch();
}
←