Linear Algebra and the C Language/a00c


Install this file in your working directory.

/* ------------------------------------ */
/*  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);    	
}
/* ------------------------------------ */
/* ------------------------------------ */

clrscrn(); clears the screen by introducing empty lines.

stop(); stops the program.

stop_w(); stops a while() or a do while() loop.

If you want to stop the program without display on the screen you can directly use getchar();