D program code

Adam D. Ruppe destructionator at gmail.com
Wed Nov 13 06:42:20 PST 2013


On Wednesday, 13 November 2013 at 14:36:22 UTC, Vincent wrote:
>          it shows the result it will totally exit and I can't 
> see the output.

din.getc has something in its buffer already (the newline from 
when you hit enter after readf - it uses the number but left the 
line), so it doesn't have to wait.

Simplest fix is to read two lines at the end:


         writeln("Result: ", result);
         readln(); // skip past the enter left from second number
         readln(); // wait for the user to hit enter again to exit


(I'm using readln instead of din so you can just use std.stdio 
alone)


More information about the Digitalmars-d mailing list