d great one
Apprentice
- Joined
- Nov 4, 2007
- Sythe Gold
- 0
- Messages
- 930
Code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
main()
{
char additional;
float vm1=50,vm2=75,vm3=40,price,totalamount,payment,change;
int order,quantity;
printf("Menu\n\n[1] VM1 Chicken and stuffs 50.00\n[2] VM2 Hamburger and stuffs 75.00\n[3] VM3 etc and stuffs 40.00\n");
additional='y';
while(additional=='y'||additional=='Y')
{
printf("\nEnter the menu number of your order: ");
scanf("%d",&order);
switch(order)
{
case 1:
price=vm1;
break;
case 2:
price=vm2;
break;
case 3:
price=vm3;
break;
default:
printf("Not available");
price=0;
goto ao;
break;
}
printf("\nHow many order: ");
scanf("%d",&quantity);
totalamount=price*quantity;
ao:
printf("\nIs there any additional order?\nY = yes N = no\nAnswer: ");
scanf("%s",&additional);
if(price=0&&additional=='n')
{
exit(0);
}
}
printf("\nHow much is your money: ");
scanf("%f",&payment);
change=payment-totalamount;
printf("\nYour total bill is %.2f\nYour money is %.2f\nYour change is %.2f",totalamount,payment,change);
getch();
}
Ok, so I found well, in a quick research that if you use exit(0); then my program will terminate. But it ain't working. So what is wrong with my code?
EDIT: Never mind. I already solve the problem.

