Thread: Error displaying all the infos entered by the user

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    5

    Error displaying all the infos entered by the user

    Code:
    #include<stdio.h>
    
    
    main()
    {
          int item_code, quantity;
          char ans, y;
          
          //Display Welcome
          printf("\t\t\t\t***Welcome Guest***");
          printf("\n\nPlease seletct your order in the list of items below: ");
          printf("\n\nPrice \t\tItem Code \t\tName of Item");
          printf("\n\n349.00 \t\t   1 \t\t\tDream Pillow");
          printf("\n\n349.00 \t\t   2 \t\t\tBolster Pillow");
          printf("\n\n549.00 \t\t   3 \t\t\tFantasy Pillow");
          printf("\n\n599.00 \t\t   4 \t\t\tHealth Pillow");
          
          //Enter item Code 
          1;
          printf("\n\n\nEnter the item code: ");
          scanf("%d", &item_code);
          
           if ((item_code>0)&&(item_code<5)){
              
           
               printf("\nEnter Item Quantity: ");
               scanf("%d", &quantity);}
               
                else {
                printf("Invalid Input!");
                getch();
                exit(0);
                }
           //Prompt Do you wish to continue
               printf("\n\nDo you wish to continue?: y/n\n");
               scanf("%s", &ans);
                
               if (ans=='y')
               
                             
                  { system("cls"); } 
                   
                 else  
               
               if (ans=='n') 
                  
                  { exit(0);}
                  
                 else 
                   
                  { printf("\nInvalid Input! program will now exit");
                  exit(0);} 
                           
           //Display Personal Info                   
                   char name, address, pcode, contact, e_add;
                   char mop, date, a;
                   
                   printf("Please fill up your personal information");
                   printf("\n\nComplete Name: ");
                   scanf("%s", &name);
                   printf("Complete Address: ");
                   scanf("%s", &address);
                   printf("Postal Code: ");
                   scanf("%s", &pcode);
                   printf("Contact No: ");
                   scanf("%s", &contact);
                   printf("E-mail address: ");
                   scanf("%s", &e_add);
           
          // Enter Code
                  
                   printf("\n*********************************************");
                   printf("\n\nMode of Payment \tCode");
                   printf("\n\nBank Deposit \t\tA");
                   printf("\nMoney Transfer \t\tB");
                   printf("\n\n*********************************************");
                   printf("\nEnter the code of your chosen mode of payment:\n");
                   scanf("%s", &mop);
                   
                      if((mop=='A')||(mop=='a')){
                      
                      printf("\nMode of Payment: Bank Deposit");}
                      
                      else
                      
                      if((mop=='B')||(mop=='b')){
                                  
                      printf("\nMode of Payment: Money Transfer");}
                      
                      
                      else
                      {
                      printf("Invalid Input!");
                      getch();
                      exit(0);}
                   
                   
                   printf("\n\nDate of Payment: ");
                   scanf("%s", &date);   
                
                
                   
           // Prompt do you wish to continue
                    printf("\nDo you wish to continue?: y/n\n");
               scanf("%s", &ans);
                
               if (ans=='y')
               
                             
                  { system("cls"); } 
                   
                 else  
               
               if (ans=='n') 
                  
                  { exit(0);}
                  
                 else 
                   
                   { printf("\nInvalid Input! program will now exit");
                  exit(0);} 
                  
           
           //Display Claim Order
          char code;
          
          printf("How to claim your order \tCode");
          printf("\n\nPick-up \t\t\tA");
          printf("\nDelivery \t\t\tB");
    
    
           //Enter DeliveryCode
          printf("\n\nEnter code here: ");
          scanf("%s", &code);
          
                      if((code=='A')||(code=='a')){
                      
                      printf("\nOrder by: Pick-up");}
                      
                      else
                      
                      if((code=='B')||(code=='b')){
                                  
                      printf("\nOrder by: Delivery");}
                      
                      
                      else
                      {
                      printf("Invalid Input!");
                      getch();
                      exit(0);}
                   
           
           // Prompt do you wish to continue
            printf("\n\nDo you wish to continue?: y/n\n");
               scanf("%s", &ans);
                
               if (ans=='y')
               
                             
                  { system("cls"); } 
                   
                 else  
               
               if (ans=='n') 
                  
                  { exit(0);}
                  
                 else 
                   
                    { printf("\nInvalid Input! program will now exit");
                  exit(0);} 
                             
           
          printf("\n________________________________________________________________________________");
          printf("\n\t\t\t\tORDER VERIFICATION\n");
          printf("\n\nOrdered item/s: %d", item_code);
           //Prompt 1 or 2
          
          
          printf("Complete name: %s",name);
          printf("Complete Address: %s\n",address);
          printf("Postal Code: %s\n",pcode);
          printf("Contact Number: %s\n",contact);
          printf("E-mail Address: %s\n",e_add);
    
    
           //Display Merchant Details
          printf("\n________________________________________________________________________________");
          printf("\nPlease copy the merchant's details for sending your payments  \n");
          printf("\nFor Bank Deposit: \n");
          printf("\tAccount name: Chin Go\n\tAccount number: 4444-8888-48\n\tName of bank: Banco de Oro\n");
          printf("\n\tFor Money Transfer: \n");
          printf("\tName: Chin Go\tContact No.: 888-8888\tAddress: Blk-88 Lot -01 Lucky Village, Pasig City\n");
          printf("\n________________________________________________________________________________");
          
          
           
           // Press any key 
           
           //Display tranasaction complete
           
          
          getch();
          exit(0);
                     
          getch();
    
    
    }
    Last edited by primeG; 03-04-2013 at 07:35 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. error while counting the number of words entered by user
    By Shinzu911 in forum C Programming
    Replies: 1
    Last Post: 05-04-2012, 03:13 AM
  2. turns the name entered by the user
    By Magic-Man-fci in forum C++ Programming
    Replies: 1
    Last Post: 04-12-2011, 12:14 AM
  3. How do you check how many characters a user has entered?
    By engstudent363 in forum C Programming
    Replies: 5
    Last Post: 04-08-2008, 06:05 AM
  4. How to hide what a user has entered with *'s
    By stuartg123 in forum C++ Programming
    Replies: 14
    Last Post: 04-16-2007, 01:29 PM
  5. use user entered formula to calculate something
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 12-07-2001, 02:21 AM