mirror of
https://github.com/dlang/phobos.git
synced 2025-05-12 23:29:01 +03:00
fix issue 20882 - Outdated examples in the documentation (std.stdio)
This commit is contained in:
parent
45e3ca3acf
commit
372b20ca17
1 changed files with 6 additions and 2 deletions
|
@ -342,6 +342,8 @@ automatically closed.
|
||||||
Example:
|
Example:
|
||||||
----
|
----
|
||||||
// test.d
|
// test.d
|
||||||
|
import std.stdio;
|
||||||
|
|
||||||
void main(string[] args)
|
void main(string[] args)
|
||||||
{
|
{
|
||||||
auto f = File("test.txt", "w"); // open for writing
|
auto f = File("test.txt", "w"); // open for writing
|
||||||
|
@ -1748,6 +1750,7 @@ Example:
|
||||||
// Read lines from `stdin` into a string
|
// Read lines from `stdin` into a string
|
||||||
// Ignore lines starting with '#'
|
// Ignore lines starting with '#'
|
||||||
// Write the string to `stdout`
|
// Write the string to `stdout`
|
||||||
|
import std.stdio;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -1778,6 +1781,7 @@ largest buffer returned by `readln`:
|
||||||
Example:
|
Example:
|
||||||
---
|
---
|
||||||
// Read lines from `stdin` and count words
|
// Read lines from `stdin` and count words
|
||||||
|
import std.array, std.stdio;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -3220,7 +3224,7 @@ Example:
|
||||||
Produce a grayscale image of the $(LINK2 https://en.wikipedia.org/wiki/Mandelbrot_set, Mandelbrot set)
|
Produce a grayscale image of the $(LINK2 https://en.wikipedia.org/wiki/Mandelbrot_set, Mandelbrot set)
|
||||||
in binary $(LINK2 https://en.wikipedia.org/wiki/Netpbm_format, Netpbm format) to standard output.
|
in binary $(LINK2 https://en.wikipedia.org/wiki/Netpbm_format, Netpbm format) to standard output.
|
||||||
---
|
---
|
||||||
import std.algorithm, std.range, std.stdio;
|
import std.algorithm, std.complex, std.range, std.stdio;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@ -3230,7 +3234,7 @@ void main()
|
||||||
iota(-1, 3, 2.0/size).map!(y =>
|
iota(-1, 3, 2.0/size).map!(y =>
|
||||||
iota(-1.5, 0.5, 2.0/size).map!(x =>
|
iota(-1.5, 0.5, 2.0/size).map!(x =>
|
||||||
cast(ubyte)(1+
|
cast(ubyte)(1+
|
||||||
recurrence!((a, n) => x + y*1i + a[n-1]^^2)(0+0i)
|
recurrence!((a, n) => x + y * complex(0, 1) + a[n-1]^^2)(complex(0))
|
||||||
.take(ubyte.max)
|
.take(ubyte.max)
|
||||||
.countUntil!(z => z.re^^2 + z.im^^2 > 4))
|
.countUntil!(z => z.re^^2 + z.im^^2 > 4))
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue