home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / dos / prg / alb_c10 / chap_10 / ch10_10.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-08  |  990 b   |  48 lines

  1. /*********************************************************************
  2. *  CH10_10.C                          Tableau de pointeurs sur des *
  3. *                     chaεnes de longueurs diffΘrentes *
  4. *********************************************************************/
  5.  
  6. #include<stdio.h>
  7.  
  8. void LitInt( int*);
  9.  
  10. main( void)
  11. {
  12.     char *jours[]={
  13.             "lundi",
  14.             "mardi",
  15.             "mercredi",
  16.             "jeudi",
  17.             "vendredi",
  18.             "samedi",
  19.             "dimanche"
  20.               };
  21.     int n, x= 5, y= 3;
  22.  
  23.     do
  24.         {
  25.        printf(" Entrez un entier de 1 α 7: ");
  26.        LitInt( &n);
  27.     }
  28.         while( n< 1 || n> 7);
  29.  
  30.     printf("\n Le jour correspondant α %d est %s", n, jours[n-1]);
  31.  
  32.     printf("\n Le %dΦme caractΦre de la %dΦme chaεne: %c",
  33.                 y, x, *( jours[x- 1]+ y- 1) );
  34. }
  35.  
  36. void LitInt( int *entier)
  37. {
  38.     double dble;
  39.     do
  40.         {
  41.        while( scanf("%lf", &dble)!= 1)
  42.         while( getchar() != '\n');
  43.        while( getchar() != '\n');
  44.     }
  45.     while( dble< -32768.0 || dble> 32767.0);
  46.         *entier= (int) dble;
  47. }
  48.