Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -0,0 +1,63 @@
|
|||
Type physical As Double
|
||||
|
||||
Enum food
|
||||
oyster = 1
|
||||
trout
|
||||
bloater
|
||||
chocolate
|
||||
truffles
|
||||
cheesecake
|
||||
cream
|
||||
pudding
|
||||
pie
|
||||
End Enum
|
||||
|
||||
Type ActualFood
|
||||
nombre As Integer
|
||||
size As physical
|
||||
quantity As physical
|
||||
End Type
|
||||
|
||||
Type foodbox
|
||||
Item(100) As ActualFood
|
||||
max As Integer
|
||||
End Type
|
||||
|
||||
Sub put_(Byref fb As foodbox, Byval f As Integer, Byval s As physical, Byval q As physical)
|
||||
fb.max += 1
|
||||
fb.Item(fb.max).nombre = f
|
||||
fb.Item(fb.max).size = s
|
||||
fb.Item(fb.max).quantity = q
|
||||
End Sub
|
||||
|
||||
Sub GetNext(Byref fb As foodbox, Byref Stuff As ActualFood)
|
||||
If fb.max > 0 Then
|
||||
Stuff = fb.Item(fb.max)
|
||||
fb.max -= 1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Type Gourmand
|
||||
WeightGain As physical
|
||||
SleepTime As physical
|
||||
End Type
|
||||
|
||||
Sub eats(Byref g As Gourmand, Byref stuff As ActualFood)
|
||||
g.WeightGain += stuff.size * stuff.quantity * 0.75
|
||||
stuff.size = 0
|
||||
stuff.quantity = 0
|
||||
End Sub
|
||||
|
||||
' Test
|
||||
Dim As foodbox Hamper
|
||||
Dim As Gourmand MrG
|
||||
Dim As ActualFood Course
|
||||
|
||||
put_(Hamper, food.pudding, 3, 7)
|
||||
put_(Hamper, food.pie, 7, 3)
|
||||
GetNext(Hamper, Course)
|
||||
eats(MrG, Course)
|
||||
|
||||
Print MrG.WeightGain ' result 15.75
|
||||
|
||||
Sleep
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
function Min<T>(a: array of T): T; where T: IComparable<T>;
|
||||
begin
|
||||
Result := a[0];
|
||||
for var i:=1 to a.Length - 1 do
|
||||
if a[i].CompareTo(Result) < 0 then
|
||||
Result := a[i];
|
||||
end;
|
||||
|
||||
type Point = record(IComparable<Point>)
|
||||
x,y: integer;
|
||||
constructor (xx,yy: integer) := (x,y) := (xx,yy);
|
||||
function CompareTo(p: Point): integer;
|
||||
begin
|
||||
Result := x.CompareTo(p.x);
|
||||
if Result = 0 then
|
||||
Result := y.CompareTo(p.y);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var a := Arr(new Point(2,3),new Point(1,4), new Point(3,1));
|
||||
Print(Min(a));
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue