Mathc matrices/Fichiers h : z r

Un livre de Wikilivres.


Installer ce fichier dans votre répertoire de travail.


Bibliothèque


z_s.h
/* ------------------------------------ */
/*  Save as :   z_s.h                   */
/* ------------------------------------ */

/* ------------------------------------ */
void clrscrn(void)
{
  printf("\n\n\n\n\n\n\n\n\n\n"
         "\n\n\n\n\n\n\n\n\n\n"
         "\n\n\n\n\n\n\n\n\n\n");
}
/* ------------------------------------ */
void stop(void)
{
 printf(" Press return to continue. ");
 fflush(stdout);
 getchar();
}
/* ------------------------------------ */
int stop_w(void)
{
    printf("\n Press   return to continue");
    printf("\n Press X return to stop    ");
    
 fflush(stdout);  
 return(toupper(getchar())!='X');
}
/* ------------------------------------ */
void pause(void)
{
int i=0;
int j=400;

while(--j)

   {i=200000;

    while(--i);
    }
}
/* ------------------------------------ */
int factorial(int n)
{
int i = 1;
int x = 1;

  if(n==0)     return (1); 
  
  for(i = 1; i <= n; i++)
        
        x *= i;
      	
 return (x);    	
}
/* ------------------------------------ */
/* ------------------------------------ */

La fonction clrscrn(); efface l'écran en introduisant des lignes vides.

La fonction stop(); arrête le programme.

La fonction stop_w(); arrête une boucle while() ou do while().

Si on souhaite arrêter le programme sans affichage à l'écran on peut directement utiliser getchar();