32 lines
514 B
D
32 lines
514 B
D
import std.stdio : writeln;
|
|
import std.algorithm : sort;
|
|
import duck;
|
|
|
|
void main()
|
|
{
|
|
Duck[] ducks = [
|
|
new Duck("Daffy", 8),
|
|
new Duck("Dewey", 2),
|
|
new Duck("Howard", 7),
|
|
new Duck("Louie", 2),
|
|
new Duck("Donald", 10),
|
|
new Duck("Huey", 2)
|
|
];
|
|
|
|
writeln("Before sorting:");
|
|
display(ducks);
|
|
|
|
ducks.sort();
|
|
|
|
writeln("\nAfter sorting:");
|
|
display(ducks);
|
|
}
|
|
|
|
void display(Duck[] ducks)
|
|
{
|
|
foreach (val; ducks)
|
|
{
|
|
writeln(val);
|
|
}
|
|
}
|