1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main()
{
system ("COLOR F1");
string userName,userPass;
int i,orders,qnty,loginAttempt=0;
double num1=82.45,num2=88.20,num3=86.00,num4=72.50,num5=59.99,num6=58.50;
double bill[6]={0,0,0,0,0,0};
double totalBill=0;
char repeat='y';
while(loginAttempt<3)
{
cout<<"Enter your Username: ";
cin>>userName;
cout<<"Password: ";
cin>>userPass;
if(userName=="john"&&userPass=="smith")
{
cout<<"\nWelcome John!\n";
break;
}
else if(userName=="admin"&&userPass=="admin")
{
cout<<"\nWelcome admin\n";
break;
}
else
{
cout<<"Invalid login attempt. Please try again.\n"<<'\n';
loginAttempt++;
}
}
if(loginAttempt==3
)
{
cout<<"Too many login attempts! The program will now be locked.";
return 0;
}
cout<<"\nWELCOME TO GNS DINER!\n\n";
cout<<"Menu;\n";
cout<<"1.Sweet Maple BBQ Chicken Kabobs\t\t\t(P82.45)\n";
cout<<"2.Grilled Spicy Lime Chicken with Creamy Avocado Sauce\t(P88.20)\n";
cout<<"3.Grilled Triple Citrus Salmon\t\t\t\t(P86.00)\n";
cout<<"4.Grilled Cheeseburger Pizza\t\t\t\t(P72.50)\n";
cout<<"5.Western Bacon Burgers\t\t\t\t\t(P59.99)\n";
cout<<"6.Monterey Chicken Sandwiches\t\t\t\t(P58.50)\n\n";
while(repeat=='y')
{
{
cout<<"\nTake your time, what's your order?\n";
cin>>orders;
cout<<"How many?\n";
cin>>qnty;
cout<<"Anything else?(y/n): ";
cin>>repeat;
}
switch(orders)
{
case 1:
{
cout<<"You've order "<<qnty<<" Sweet Maple BBQ Chicken Kabobs.\n";
bill[0]+=num1*qnty;
break;
}
case 2:
{
cout<<"You've order "<<qnty<<" Grilled Spicy Lime Chicken with Creamy Avocado Sauce.\n";
bill[1]+=num2*qnty;
break;
}
case 3:
{
cout<<"You've order "<<qnty<<" Grilled Triple Citrus Salmon.\n";
bill[2]+=num3*qnty;
break;
}
case 4:
{
cout<<"You've order "<<qnty<<" Grilled Cheeseburger Pizza.\n";
bill[3]+=num4*qnty;
break;
}
case 5:
{
cout<<"You've order "<<qnty<<" Western Bacon Burgers.\n";
bill[4]+=num5*qnty;
break;
}
case 6:
{
cout<<"You've order "<<qnty<<" Monterey Chicken Sandwiches.\n";
bill[5]+=num6*qnty;
break;
}
}
}
for(i=0;i<6;i++)
{
totalBill=totalBill+bill[i];
}
cout<<totalBill<<endl;
}
|