4 глава

This commit is contained in:
Alexander Zhirov 2023-02-05 19:45:16 +03:00
parent e0caa7caab
commit ec805e7f08
15 changed files with 1584 additions and 1 deletions

View file

@ -0,0 +1,24 @@
import std.math, std.stdio;
struct Point
{
double x, y;
double norm()
{
return sqrt(x * x + y * y);
}
}
void main()
{
Point p;
int z;
with (p)
{
x = 3; // При­сваи­ва­ет зна­че­ние по­лю p.x
p.y = 4; // Хо­ро­шо, что все еще мож­но яв­но ис­поль­зо­вать p
writeln(norm()); // Вы­во­дит зна­че­ние по­ля p.norm, то есть 5
z = 1; // По­ле z ос­та­лось ви­ди­мым
}
}