home *** CD-ROM | disk | FTP | other *** search
- /*********************************************************************
- * CH12_03.C Exemple d'utilisation d'une ΘnumΘration *
- *********************************************************************/
-
- #include<stdio.h>
-
- void LitChar( char*);
-
- main( void)
- {
- char choix= 'z';
-
- enum test { non, oui} saisie= non; /* DΘfinition, dΘclaration et
- initialisation de l'ΘnumΘration "saisie" du type "test". */
-
- /* A cet endroit nous avons la dΘclaration de la structure,
- la saisie du nombre de couples et l'allocation de mΘmoire. */
-
- while( choix != 'F')
- {
- printf("\n\t ---------------------------------------\n"
- "\t Saisie des donnΘes\n"
- "\t VΘrification\n"
- "\t Calcul et affichage\n"
- "\t Fin\n"
- "\t ---------------------------------------\n");
-
- LitChar( &choix);
- if( ( choix> 96) && ( choix< 123) ) choix-= 32;
-
- switch( choix)
- {
- case 'S': printf("\n Saisie des donnΘes: LitTab()");
- saisie= oui;
- break;
-
- case 'V': if( saisie== non)
- {
- printf("\n Saisissez d'abord les donnΘes!");
- break;
- }
- printf("\n VΘrification des donnΘes:"
- " Veriftab()");
- break;
-
- case 'C': if( saisie!= oui)
- {
- printf("\n Saisissez d'abord les donnΘes!");
- break;
- }
- printf("\n Calcul et affichage:"
- " LitStat() et GetStat()");
- break;
-
- case 'F': break;
- default: printf("erreur! composez S, V, C ou F\n");
- }
- }
- printf("\t\t*** fin du programme ***");
- }
-
- void LitChar( char *c0)
- {
- while( ( *c0= getchar() )== '\n');
- while( getchar() != '\n');
- }
-