i have a problem with my last case in the switch statement where you will see the result
in my codes i can`t copy the first order number that i type like the picture above, it always shows 8
Can anyone of you guys help me here is my codes
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int password, a, b;
float p;
do{
system("cls");
printf("pin:");
scanf("%d",&password);
}
while(password!=12345);
printf("Successfully logged in!");
system("cls");
printf("===========================================\n");
printf(" JOLLIBEE POS\n");
printf("===========================================\n");
printf(" [1] Burger Reg. P35.00 \n");
printf(" [2] Burger W/Cheese P40.00 \n");
printf(" [3] Spaghetti P50.00 \n");
printf(" [4] 1pc Chicken W/rice P89.00 \n");
printf(" [5] Soda <S> P20.00 \n");
printf(" [6] Soda <L> P30.00 \n");
printf(" [7] Sundae P28.00 \n");
printf("\n");
printf(" [8] Total\n");
char loop='y';
while(loop == 'y') {
printf("===========================================\n");
printf("Enter Order No:");
scanf("%d",&a);
switch (a)
{
case 1: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 35.00;
break;
case 2: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 40.00;
break;
case 3: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 50.00;
break;
case 4: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 89.00;
break;
case 5: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 20.00;
break;
case 6: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 30.00;
break;
case 7: printf("Enter Quantity:");
scanf("%d",&b);
p=b * 28.00;
break;
case 8: loop='n';
printf("===========================================\n");
printf("\n");
printf("ORDER NO. QTY SUBTOTAL\n");
printf(" %d %d %.2f\n", a, b, p);
break;
}
scanf("", &loop);
}
system("PAUSE");
return 0;
}