Thread overview
Struct List Human
Sep 24, 2017
dark777
Sep 24, 2017
Suliman
Sep 24, 2017
dark777
Sep 24, 2017
dark777
Sep 24, 2017
Neia Neutuladh
Sep 24, 2017
dark777
Sep 24, 2017
Adam D. Ruppe
Sep 24, 2017
dark777
September 24, 2017
I have the following code:
https://pastebin.com/PWuaXJNp
but typing my name does not go to the next line as soon as I press enter
how to solve this?
September 24, 2017
On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
> I have the following code:
> https://pastebin.com/PWuaXJNp
> but typing my name does not go to the next line as soon as I press enter
> how to solve this?

use writeln instead write
September 24, 2017
On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:
> On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
>> I have the following code:
>> https://pastebin.com/PWuaXJNp
>> but typing my name does not go to the next line as soon as I press enter
>> how to solve this?
>
> use writeln instead write

nothing to see hand

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.
September 24, 2017
On Sunday, 24 September 2017 at 15:51:01 UTC, dark777 wrote:
> On Sunday, 24 September 2017 at 15:22:30 UTC, Suliman wrote:
>> On Sunday, 24 September 2017 at 14:32:14 UTC, dark777 wrote:
>>> I have the following code:
>>> https://pastebin.com/PWuaXJNp
>>> but typing my name does not go to the next line as soon as I press enter
>>> how to solve this?
>>
>> use writeln instead write
>
> nothing to see hand
>
> when you execute and call
> Name:
>
> I type my name:
> Name: dark777 + [enter]
>
> and he does not jump to the next line to get the age
> This is what I want to know how to solve.

nothing to see hand

when you execute and call
Name:

I type my name:
Name: dark777 + [enter]

and he does not jump to the next line to get the age
This is what I want to know how to solve.
September 24, 2017
On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote:
> when you execute and call
> Name:
>
> I type my name:
> Name: dark777 + [enter]
>
> and he does not jump to the next line to get the age
> This is what I want to know how to solve.

Add a `writeln();` after reading input, maybe?
September 24, 2017
I think readf("%s") reads everything available. readf(" %s\n") might help but personally, I say avoid readf.

Just use readln and to!int instead


auto line = readln();
if(line.length == 0)
   writeln("please enter a number");

age = to!int(line);


to is from import std.conv
September 24, 2017
On Sunday, 24 September 2017 at 17:05:11 UTC, Neia Neutuladh wrote:
> On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote:
>> when you execute and call
>> Name:
>>
>> I type my name:
>> Name: dark777 + [enter]
>>
>> and he does not jump to the next line to get the age
>> This is what I want to know how to solve.
>
> Add a `writeln();` after reading input, maybe?

I changed the write by writeln and it still did not work, I added it after receiving the first entry and it did not work ...
September 24, 2017
On Sunday, 24 September 2017 at 18:00:32 UTC, Adam D. Ruppe wrote:
> I think readf("%s") reads everything available. readf(" %s\n") might help but personally, I say avoid readf.
>
> Just use readln and to!int instead
>
>
> auto line = readln();
> if(line.length == 0)
>    writeln("please enter a number");
>
> age = to!int(line);
>
>
> to is from import std.conv

I added \n and it worked.

I created a float variable and wanted to know how to read or print the same?

reading?

write ("Weight:");
   readf (" %ld\n", &peso);

and

writefln ("Weight:% ld", human.peso);

but he returned me errors