mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 19:03:13 +01:00
26 lines
292 B
D
26 lines
292 B
D
module e;
|
|
|
|
extern(C) int printf(char*, ...);
|
|
|
|
struct C
|
|
{
|
|
float x=0,y=0;
|
|
|
|
float dot(ref C b)
|
|
{
|
|
return x*b.x + y*b.y;
|
|
}
|
|
}
|
|
|
|
void main()
|
|
{
|
|
C a,b;
|
|
a.x = 2;
|
|
a.y = 6;
|
|
b.x = 3;
|
|
b.y = 5;
|
|
float f = a.dot(b);
|
|
printf("%f\n", f);
|
|
assert(f == 36);
|
|
}
|