Thread: Help With Libary Data Base.

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    44

    Question Help With Libary Data Base.

    Code:
    void add_a_book (BOOK book_array[])
    
    {
    
       int i=0;
    
       while ( book_array[i].number != 0 && i < SIZE )
       {
          i++;
       }
    
       if ( i == SIZE )
       {
          printf("\nSorry, the database is full\n");
       }
       else
       {
          printf( "\f\nBook Number (1 to 3 digits, except 0) : " );
       }
       do
          scanf( "%d",&book_array[i].number );
    
       while (book_array[i].number <= 0 );
    
       printf("\nBook Name (Maximum 30 characters) : " );
       scanf("%s",&book_array[i].name );
       fflush(stdin);
    
       printf("\nBook Status 1=(Y)es or 2=(N)o : " );
       scanf("%d",&book_array[i].status );
    
       printf("\n\n%d\n\n",  &book_array[i].status);
       
    }
    the status on this funcion is a int and can be either 1 or 0 but it will not store the correct value for me. any help would be greatly recieved.
    Dangerous Dave

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    44
    the last line of the code simpley prints out the value stored in status.

    but it does not for some reason.
    Dangerous Dave

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Must I do my 'printf' tutorial again?? Do not use the & operator for printf.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    44
    did i not say i knew that was the address and i was just testing everyone. thanx for the help man.

    well done on 1k posts.
    Dangerous Dave

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >did i not say i knew that was the address and i was just testing everyone.

    say what?

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    44
    JOKE!
    Dangerous Dave

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. singly linked circular list
    By DarkDot in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2007, 08:55 PM
  2. simultaneously waiting for data on FIFO and UDP using select call
    By yogesh3073 in forum Networking/Device Communication
    Replies: 2
    Last Post: 01-05-2007, 09:53 AM
  3. Where's the EPIPE signal?
    By marc.andrysco in forum Networking/Device Communication
    Replies: 0
    Last Post: 12-23-2006, 08:04 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM