Thread: how to u overwrite data in array.My scanf does not read out the data on my array list

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    23

    Post how to u overwrite data in array.My scanf does not read out the data on my array list

    Code:
    #include<stdio.h>void main()
    {
        char letter;
        char Results[4][3],row,column;
        int count;
        int admin[5];
        int no_of_movie_tickets;
        int no_of_pop_corn_packs;
        int points;
        
        
        printf("XYZ-ABC ONLINE MOVIE TREATS REDEMPTION SYSTEM \n");   //main menu 
        printf("(A) INPUT Redemption Status Check \n");
        printf("(B) Redemption Status Check \n");
        printf("(C) Display succesful redemptions \n");
        printf("(D) Quit \n");
    
    
        flushall();
    
    
        
        {
                   for( int count=0; count<5; count++)  //Function for case A, allows only 5 redemptions
                   {
                     
                      printf("Please input your Admin No:");           //ask user for admin no
                      scanf("%d",&admin[count]);
                               
    
    
                      printf("Number of movie tickets:");   
                      scanf("%d",&no_of_movie_tickets);       //ask user for no of movie tickets
    
    
                      printf("Number of pop corn packs:");
                      scanf("%d",&no_of_pop_corn_packs);       //ask user for no of pop corn packs
                      printf("\n");
    
    
                
                    
                           points = no_of_movie_tickets  * 125 + no_of_pop_corn_packs * 75;
                           if(points<500)                     
                        {
                            printf("Redemption Status: Successful\n");
                            printf("Admin No:%d\n",admin[count]);
                            printf("Number of movie tickets:%d\n",no_of_movie_tickets);
                            printf("Number of pop corn packs:%d\n",no_of_pop_corn_packs);
                            printf("Redemption points used:%d\n\n",points);
                        }
                        else
                        {
                            count = count - 1;
                            printf("Redemption Status: Unsuccessful\n");
                        }    
                   }
                   
                   printf("Admin No.\t\tTickets\t\tPop_corn\t\tPoints\n");
                   for(int row=0;row<5;row++)
                   {
                      
                      
                          printf("%d\t\t\t%d\t\t\t%d\t\t\t%d\n",admin,no_of_movie_tickets,no_of_pop_corn_packs,points);
                                            
                    }
                   
            }
        
        printf("Please try again tomorrow. Thankyou\n");                               // after 5 successful attemptions, prints this out
    }
    i was told to remove the columns in my for loop() to prevent my row from over looping..problem settled.But...the data in my scanf does not print on my initialized array...help!

    below is how my program displays...

    how to u overwrite data in array.My scanf does not read out the data on my array list-picture3-jpg
    Last edited by smeraldan; 02-10-2012 at 04:39 AM.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Stop double posting, and answer the questions I asked in the other thread.

    We will get you going, but stop double posting. Just be clear and responsive, and DON'T POST in this thread.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to read data of any type into array
    By narendrav in forum C Programming
    Replies: 1
    Last Post: 12-02-2011, 07:15 AM
  2. use of array to read student data
    By jackson6612 in forum C++ Programming
    Replies: 11
    Last Post: 06-05-2011, 08:25 AM
  3. Read size of data array when reading .txt data
    By Taquito in forum C Programming
    Replies: 13
    Last Post: 04-29-2007, 01:52 AM
  4. Function to read data from file to array
    By anatazi in forum C Programming
    Replies: 3
    Last Post: 07-01-2002, 11:08 PM
  5. how do i read this data from a file instead of this array
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 06-16-2002, 11:32 PM