Mathc initiation/Fichiers h : z r2

Un livre de Wikilivres.


Sommaire



Installer ce fichier dans votre répertoire de travail.

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("\n Press return to continue. ");
 getchar();
}
/* ------------------------------------ */
int stop_w(void)
{
    printf("\n Press return to continue"
           "\n Press X      to stop    ");
     
 return(toupper(getchar())!='X');
}
/* ------------------------------------ */
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 les boucles while() et do[]while().