Mercurial > projects > ldc
comparison test/e.d @ 1:c53b6e3fe49a trunk
[svn r5] Initial commit. Most things are very rough.
author | lindquist |
---|---|
date | Sat, 01 Sep 2007 21:43:27 +0200 |
parents | |
children | d9d5d59873d8 |
comparison
equal
deleted
inserted
replaced
0:a9e71648e74d | 1:c53b6e3fe49a |
---|---|
1 module e; | |
2 | |
3 struct C | |
4 { | |
5 float x=0,y=0; | |
6 | |
7 float dot(ref C b) | |
8 { | |
9 return x*b.x + y*b.y; | |
10 } | |
11 } | |
12 | |
13 void main() | |
14 { | |
15 C a,b; | |
16 a.x = 2; | |
17 a.y = 6; | |
18 b.x = 3; | |
19 b.y = 5; | |
20 float f = a.dot(b); | |
21 printf("%f\n", f); | |
22 assert(f == 36); | |
23 } |