Re: Any additions for write-to-file short program

2021-11-18 Thread Stanislav Blinov via Digitalmars-d-learn
On Thursday, 18 November 2021 at 22:20:48 UTC, pascal111 wrote: In next program that rewrites original written texts into new files, I see that it may need some additions or we can accept it like this because it's just a simple program that achieve its task and doesn't need any philosophical

Re: Any additions for write-to-file short program

2021-11-18 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 18, 2021 at 10:20:48PM +, pascal111 via Digitalmars-d-learn wrote: > In next program that rewrites original written texts into new files, I > see that it may need some additions or we can accept it like this > because it's just a simple program that achieve its task and doesn't >

Any additions for write-to-file short program

2021-11-18 Thread pascal111 via Digitalmars-d-learn
In next program that rewrites original written texts into new files, I see that it may need some additions or we can accept it like this because it's just a simple program that achieve its task and doesn't need any philosophical additions. Example: Original text: Learning C doesn't impact

Re: writeln the struct from the alis this Example from the home page

2021-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/18/21 2:58 PM, Jordan Wilson wrote: On Thursday, 18 November 2021 at 16:08:22 UTC, Paul Backus wrote: On Thursday, 18 November 2021 at 13:51:42 UTC, Martin Tschierschke wrote: [...] You can define a `toString` method, like this: ```d string toString() {     import std.conv;     return

Re: writeln the struct from the alis this Example from the home page

2021-11-18 Thread Jordan Wilson via Digitalmars-d-learn
On Thursday, 18 November 2021 at 16:08:22 UTC, Paul Backus wrote: On Thursday, 18 November 2021 at 13:51:42 UTC, Martin Tschierschke wrote: [...] You can define a `toString` method, like this: ```d string toString() { import std.conv; return p.to!string; } ``` You can find more

Re: writeln the struct from the alis this Example from the home page

2021-11-18 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 18 November 2021 at 13:51:42 UTC, Martin Tschierschke wrote: Hello, if you take the example from the home page, with the additional last line: ```d struct Point { private double[2] p; // Forward all undefined symbols to p alias p this; double dot(Point rhs) {

writeln the struct from the alis this Example from the home page

2021-11-18 Thread Martin Tschierschke via Digitalmars-d-learn
Hello, if you take the example from the home page, with the additional last line: ```d struct Point { private double[2] p; // Forward all undefined symbols to p alias p this; double dot(Point rhs) { return p[0] * rhs.p[0] + p[1] * rhs.p[1]; } } void main() {