What's wrong with my code?

Discussion in 'Programming General' started by d great one, Jun 28, 2009.

Thread Status:
Not open for further replies.
What's wrong with my code?
  1. Unread #1 - Jun 28, 2009 at 1:22 PM
  2. d great one
    Joined:
    Nov 4, 2007
    Posts:
    930
    Referrals:
    2
    Sythe Gold:
    0

    d great one Apprentice

    What's wrong with my code?

    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.
     
< missing component | fun li mouse trick >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site