Thread: how to scan a var in enum

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    9

    Question how to scan a var in enum

    good morning
    As you see in my code source
    I ceated the enum boolean
    but the problem is when I want to scan "biblio[i].emprunter"
    what should i use ?
    scanf or gets or what ??
    and If I must use scanf what should I use whit it ? "%d'' or "%s" ...etc
    Code:
    #include <stdio.h>
    typedef struct fiche fiche;
    typedef enum Booleen Booleen ;
    typedef enum Categorie Categorie ; 
        enum Booleen {vrai,faux};
        enum Categorie {Conte=0,Policier=1,Roman=2,Histoire=3};
        struct fiche    
        {
            int cote ;
            char titre [100];    
            Categorie categorie;        
            Booleen emprunter ;
            int annee ;
        };
    main()
    {
        FILE* bib;
        int nblivre,i;
        fiche biblio[500];
    /************************************************************************************************************/
     
            scanf("%d",&biblio[i].emprunter);
            printf("Donnez l'annee de l'edition :");
            getchar();
            scanf("%d",&biblio[i].annee);
        }
    I'm waitting for your help
    and thank you !
    Last edited by med linux; 03-24-2011 at 04:49 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assigning enum types to enum types?
    By see the big C in forum C Programming
    Replies: 10
    Last Post: 12-21-2010, 02:32 AM
  2. Replies: 3
    Last Post: 08-16-2010, 10:00 AM
  3. Need help assignment
    By 6kaine9 in forum C Programming
    Replies: 26
    Last Post: 10-19-2008, 08:51 PM
  4. server question
    By xddxogm3 in forum Tech Board
    Replies: 24
    Last Post: 01-21-2004, 01:12 AM
  5. Vigenere Decipher/Encipher
    By Xander in forum C++ Programming
    Replies: 5
    Last Post: 02-15-2002, 09:24 AM