"readln" after "readf"

pascal111 judas.the.messiah.111 at gmail.com
Thu Sep 21 09:14:14 UTC 2023


I've a problem when I'm using "readln" after "readf" that I 
couldn't see my program rest and the lines of the execution ran 
fast:

module main;

import std.stdio;
import std.string;
import std.conv;

int main(string[] args)
{

         char[] yy;
         int x,y,z;


         writef("Enter a number: ");
         readf(" %d",&x);


         writef("Enter a number: ");
         readf(" %d",&y);

         z=x+y;
         writefln("Hi! %d",z);

         writef("Enter a number: ");
         readln(yy);
         yy = strip(yy);
         x=to!int(yy);

         writef("Enter a number: ");
         readln(yy);
         yy = strip(yy);
         y=to!int(yy);

         z=x+y;
         writefln("Hi! %d",z);

     	return 0;
     }


More information about the Digitalmars-d-learn mailing list