Перенос страниц
This commit is contained in:
parent
4d57446057
commit
4c954c9186
129 changed files with 14 additions and 15 deletions
23
book/03-инструкции/src/chapter-3-7-5/app.d
Normal file
23
book/03-инструкции/src/chapter-3-7-5/app.d
Normal file
|
@ -0,0 +1,23 @@
|
|||
import std.stdio;
|
||||
|
||||
void print(double[string] map)
|
||||
{
|
||||
foreach (i, e; map)
|
||||
{
|
||||
writefln("array['%s'] = %s;", i, e);
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float[] arr = [ 1.0, 2.5, 4.0 ];
|
||||
|
||||
foreach (ref float elem; arr)
|
||||
{
|
||||
elem *= 2; // Без проблем
|
||||
}
|
||||
|
||||
writeln(arr);
|
||||
|
||||
print(["Луна": 1.283, "Солнце": 499.307, "Проксима Центавра": 133_814_298.759]);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue