Professional Documents
Culture Documents
Rhorrace Prog1
Rhorrace Prog1
Rhorrace Prog1
cout << " Would you kindly hit Y to enter:" << endl;
cin >> loop;
loop = toupper(loop);
again = 'Y';
total = 0;
while(!isalpha(loop) || loop != 'Y' && loop != 'E')
{
cout << "Error: does not compute" << endl;
cout << "Would you kindly hit Y to enter:";
cin >> loop;
loop = toupper(loop);
}
while(loop == 'Y' && again == 'Y')
{
//bread selection
cout << "A=bread" << endl;
cout << "B=bun" << endl;
cout << "C=tortilla" <<endl;
cout << "Would you kindly choose the type of bun you wou
ld like(A/B/C):";
cin >> bunchoice;
bunchoice = toupper(bunchoice);
while(!isalpha(bunchoice) || bunchoice > 'C')
{
cout << "Error: choice must be either A, B, or C
" << endl;
cout << "Would you kindly choose the type of bu
n you would like(A/B/C):";
cin >> bunchoice;
bunchoice = toupper(bunchoice);
}
//bread type
if(bunchoice == 'A')
{
cout << "A=white" << endl;
cout << "B=wheat" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of bre
ad you would like(A/B/C):";
cin >> bread;
bread = toupper(bread);
while(!isalpha(bread) || bread > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of bread you would like(A/B/C):";
cin >> bread;
bread = toupper(bread);
}
}
//bun type
if(bunchoice == 'B')
{
cout << "A=plain" << endl;
cout << "B=sesame seed" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of ham
burger bun you would like(A/B/C):";
cin >> bun;
bun=toupper(bun);
while(!isalpha(bun) || bun > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of hamburger bun you wuld like(A/B/C):";
cin >> bun;
bun = toupper(bun);
}
}
//tortilla type
if(bunchoice == 'C')
{
cout << "A=flour" << endl;
cout << "B=corn" << endl;
cout << "C=gluten free" << endl;
cout << "Would you kindly choose the type of tor
tilla you would like(A/B/C):";
cin >> tortilla;
tortilla=toupper(tortilla);
while(!isalpha(tortilla) || tortilla > 'C')
{
cout << "Error: choice must be either A,
B, or C" << endl;
cout << "Would you kindly choose the typ
e of tortilla you would like(A/B/C):";
cin >> tortilla;
tortilla = toupper(tortilla);
}
}
//patty type
cout << "A=beef" << endl;
cout << "B=chicken" << endl;
cout << "C=veggie burger(black bean)" << endl;
cout << "Would you kindly choose the type of patty you w
ould like(A/B/C):";
cin >> patty;
patty = toupper(patty);
if(!isalpha(patty) || patty > 'C')
{
cout << "Error: choice must be either A, B, or C
" << endl;
cout << "Would you kindly choose the type of pat
ty you would like(A/B/C):";
cin >> patty;
patty = toupper(patty);
}
//beef
if(patty == 'A')
{
cout << "A=pink" << endl;
cout << "B=no pink" << endl;
cout << "pink or no pink?(A/B):";
cin >> cook1;
cook1 = toupper(cook1);
pattycost= 4.00;
while(!isalpha(cook1) || patty > 'B')
{
cout << "Error: choice must be either A
if(drink == 'A')
{
cout << "A=diet";
cout << "B=regular";
cout << "diet or regular(A/B):";
cin >> soda;
soda = toupper(soda);
sodacost = 2.50;
while(!isalpha(soda) || soda > 'B')
{
cout << "Error: choice must be A
or B" << endl;
cout << "diet or regular(A/B):";
cin >> soda;
soda = toupper(soda);
}
}
//water
if(drink == 'B')
{
watercost = 1.00;
}
//milkshake
if(drink == 'C')
{
cout << "A=vanilla" << endl;
cout << "B=chocolate" << endl;
cout << "vanilla or chocolate(A/B):";
cin >> milkshake;
milkshake = toupper(milkshake);
shakecost= 3.50;
while(!isalpha(milkshake) || milkshake >
'B')
{
cout << "Error: choice must be A
or B" << endl;
cout << "vanilla or chocolate(A/
B):";
cin >> milkshake;
milkshake = toupper(milkshake);
}
}
}
//compute price/display
if(patty <= 'C' && cheese <= 'C' && combo == 'N')
{
total += pattycost + cheesecost;
cout << "Your total is $" << total << endl;
}
if(patty <= 'C' && cheese == 'D' && combo == 'N')
{
total += pattycost;
cout << "Your total is $" << total << endl;
}
if(patty <='C' && cheese <= 'C' && combo == 'Y')
{
total += pattycost + cheesecost;
if(drink == 'A')
{
total += sodacost;