import std.random;
import std.stdio;
import std.string;
struct Box {
int volume;
int opCmp(const ref Box Box) const {
return (volume == Box.volume ? Box.volume - volume: volume - Box.volume);
}
string toString() const {
return format(Volume:%s\n, volume);
}
}
void main() {
Box[] Boxes;
int j = 10;
foreach (i; 0 .. 10) {
Boxes ~= Box(j*j*j);
j = j-1;
}
writeln(Unsorted Array);
writeln(Boxes);
Boxes.sort;
writeln(Sorted Array);
writeln(Boxes);
writeln(Boxes[0]<Boxes[1]);
writeln(Boxes[0]>Boxes[1]);
writeln(Boxes[0]<=Boxes[1]);
writeln(Boxes[0]>=Boxes[1]);
}