Глава 4 закончена
This commit is contained in:
parent
141dd624b1
commit
e57718386b
26 changed files with 442 additions and 2 deletions
|
@ -0,0 +1,29 @@
|
|||
import std.stdio, std.random;
|
||||
|
||||
void main()
|
||||
{
|
||||
int[128] someInts;
|
||||
|
||||
int[3] a;
|
||||
assert(a == [0, 0, 0]);
|
||||
|
||||
int[3] b = [1, 2, 3];
|
||||
assert(b == [1, 2, 3]);
|
||||
|
||||
int[4] c = -1;
|
||||
assert(c == [-1, -1, -1, -1]);
|
||||
|
||||
int[1024] d = void;
|
||||
|
||||
double[10] array;
|
||||
foreach (i; 0 .. array.length)
|
||||
{
|
||||
array[i] = uniform(0.0, 1.0);
|
||||
}
|
||||
writeln(array);
|
||||
foreach (ref element; array)
|
||||
{
|
||||
element = uniform(0.0, 1.0);
|
||||
}
|
||||
writeln(array);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue