Re: readln() doesn't stop to read the input.

2015-03-30 Thread jonaspm via Digitalmars-d
I see... thanks to everyone for helping me out!

Re: readln() doesn't stop to read the input.

2015-03-28 Thread via Digitalmars-d
You can clear the input stream: while(getchar() != '\n') {}; Or just use readln: int resp = readln.chomp.to!int;

Re: readln() doesn't stop to read the input.

2015-03-28 Thread anonymous via Digitalmars-d
On Saturday, 28 March 2015 at 03:07:31 UTC, jonaspm wrote: module main; import std.stdio; import std.string; int main(string[] args) { int resp; char[] p, q; writefln(MENU DE OPCIONES); writefln(1) Modus Ponens); writefln(2) Modus Tollens); writefln(3) Silogismo

Re: readln() doesn't stop to read the input.

2015-03-27 Thread Ivan Kazmenko via Digitalmars-d
On Friday, 27 March 2015 at 04:37:34 UTC, jonaspm wrote: Please, i need your help, I tried this: write(Write p: ); readln(p); p = chomp(p); writeln(Write q: ); readln(q); q = chomp(q); but the result is: Write p: Write q: and doesn't pause to read keyboard input... what's wrong? Thanks in

Re: readln() doesn't stop to read the input.

2015-03-27 Thread lobo via Digitalmars-d
On Friday, 27 March 2015 at 04:37:34 UTC, jonaspm wrote: Please, i need your help, I tried this: write(Write p: ); readln(p); p = chomp(p); writeln(Write q: ); readln(q); q = chomp(q); but the result is: Write p: Write q: and doesn't pause to read keyboard input... what's wrong? Thanks in

Re: readln() doesn't stop to read the input.

2015-03-27 Thread Steven Schveighoffer via Digitalmars-d
On 3/27/15 4:22 AM, tcak wrote: On Friday, 27 March 2015 at 05:17:03 UTC, jonaspm wrote: but readln(p); isn't supposed to read input and store it into p? Nope. Parameter is terminator character. Read string is returned from the function. So, it would be like: string p = readln(); readln

Re: readln() doesn't stop to read the input.

2015-03-27 Thread tcak via Digitalmars-d
On Friday, 27 March 2015 at 05:17:03 UTC, jonaspm wrote: but readln(p); isn't supposed to read input and store it into p? Nope. Parameter is terminator character. Read string is returned from the function. So, it would be like: string p = readln();

Re: readln() doesn't stop to read the input.

2015-03-27 Thread jonaspm via Digitalmars-d
module main; import std.stdio; import std.string; int main(string[] args) { int resp; char[] p, q; writefln(MENU DE OPCIONES); writefln(1) Modus Ponens); writefln(2) Modus Tollens); writefln(3) Silogismo Hipotetico); writefln(4) Salir); do{

Re: readln() doesn't stop to read the input.

2015-03-26 Thread jonaspm via Digitalmars-d
but readln(p); isn't supposed to read input and store it into p?

Re: readln() doesn't stop to read the input.

2015-03-26 Thread tcak via Digitalmars-d
On Friday, 27 March 2015 at 04:37:34 UTC, jonaspm wrote: Please, i need your help, I tried this: write(Write p: ); readln(p); p = chomp(p); writeln(Write q: ); readln(q); q = chomp(q); but the result is: Write p: Write q: and doesn't pause to read keyboard input... what's wrong? Thanks in

readln() doesn't stop to read the input.

2015-03-26 Thread jonaspm via Digitalmars-d
Please, i need your help, I tried this: write(Write p: ); readln(p); p = chomp(p); writeln(Write q: ); readln(q); q = chomp(q); but the result is: Write p: Write q: and doesn't pause to read keyboard input... what's wrong? Thanks in advance!