D Program code on CLS

Ali Çehreli acehreli at yahoo.com
Thu Nov 14 10:59:59 PST 2013


On 11/13/2013 08:59 PM, Vincent wrote:

> This is the code. where or what code will I use for clear the screen?

My Linux console environment has 'clear'. That's why I used 
system("clear") below. You may need to use system("cls") if you are e.g. 
on Windows.

import std.stdio;
import std.process;
import core.thread;

void main(string[] args)
{
     while (true)
     {
         writeln ("Calculator Menu");
         write ("Selected Number: ");

         int operation;
         readf (" %s", &operation);

         enum duration = 3.seconds;

         writefln("Thank you for %s! See you in %s.", operation, duration);
         Thread.sleep(duration);

         system("clear");
     }
}

Ali



More information about the Digitalmars-d-learn mailing list