Okay, this is what I have now. But I am still having the problem with it not ending at the sentinelMeal, I have to go one over it. I am getting a correct total and everything.
Code:
#include <stdio.h>
int main ()
{
int meals=0;
double total=0;
int sentinelMeal;
int combo;
int quantity;
double subtotal;
printf("Please enter the number of meals you would like to order:");
scanf("%d",&sentinelMeal);
while(meals<=sentinelMeal) {
printf("Menu\n1) Hamburger, Fries, and drink...................$2.79\n2) Cheeseburger, Fries, and drink................$3.09\n3) Quarterpounder, Fries and drink...............$3.29\n4) Double Cheesburger, Fries, and drink..........$3.89\n5) Grilled Chicken Sandwich, Fries, and drink....$3.19\n6) Fish Sandwich, Fries, and drink...............$3.29\n");
printf("Enter meal combo number:\n");
scanf("%d",&combo);
printf("Please enter the quantity of this combo you would like to order");
scanf("%d",&quantity);
switch(combo) {
case 1:
subtotal=2.79*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
case 2:
subtotal=3.09*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
case 3:
subtotal=3.29*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
case 4:
subtotal=3.89*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
case 5:
subtotal=3.19*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
case 6:
subtotal=3.29*quantity;
total=total+subtotal;
meals=meals+quantity;
break;
default:
printf("This combo does not exist, Please choose a combo number between 1 and 6.");
break;
}
printf("combo you entered was %d", combo);
}
printf("Purchase Receipt %21.2f",total);
return 0;
}