D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[LUG] c programming - how do I clear the screen..




Hi,  I am starting to learn c programming from the Teach yourself c book by
herbert schildt,  I have the following which I have adapted from one of the
programs in the book.  What I would like to do is clear the screen when the
program is started,  however I can't find a cls statement or unix clear
statement in c,  I would be grateful for any suggestions.  


/* Conversion Program */
/* Adapted by Paul Sutton */
/* from book Teach your self c */
/* psutton at uklinux.net */
#include <stdio.h>

int
main (void)
{
  float num;
  int choice;
/* the \n is interpreted as a carriage return */

  printf ("1: Feet to Meters. \n");
  printf ("2: Meters to Feet. \n");
  
  printf ("Please enter choice and hit enter: ");
  scanf ("%d", &choice);

  if (choice == 1)
    {
      printf ("Enter Number of Feet: ");
      scanf ("%f", &num);
      printf ("Meters: %f", num / 3.28);
    }
  else
    {
      printf ("Enter Number of Meters: ");
      scanf ("%f", &num);
      printf ("feet: %f", num * 3.28);
    }
  return 0;
}




Thanks for any help,    also do you know of any good c programming mailing
lists,  

thanks

Paul

--
lug-list - The Mailing List for the Devon & Cornwall LUG
Mail majordomo at lists.termisoc.org with "unsubscribe lug-list" in the
message body to unsubscribe.


Lynx friendly