[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: [LUG] c programming - how do I clear the screen..
> #include <stdio.h>
>
> int
> main (void)
> {
> float num;
> int choice;
> /* the \n is interpreted as a carriage return */
>
----snip----
printf(" \033[2J");
/* This inserts the ansi code for clear screen... Linux is ANSI so that
should work :-), I'll let you know for deffo after a reboot..... */
----snip----
> 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;
> }
Neil Stone
Back after a reboot....
--
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.