root/trunk/src/tutorials/examples/sorting/sorting.d
| Revision 6, 390 bytes (checked in by jcc7, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | import std.stdio; |
| 2 | |
| 3 | void main() |
| 4 | { |
| 5 | char[][] arr; |
| 6 | |
| 7 | arr.length = 5; |
| 8 | |
| 9 | arr[0] = "zebra"; |
| 10 | arr[1] = "apple"; |
| 11 | arr[2] = "cat"; |
| 12 | arr[3] = "tree"; |
| 13 | arr[4] = "boy"; |
| 14 | |
| 15 | |
| 16 | char[][] sortedArr; |
| 17 | |
| 18 | sortedArr = arr.sort; |
| 19 | |
| 20 | int i; |
| 21 | |
| 22 | for(i = 0; i < sortedArr.length; i++) |
| 23 | { |
| 24 | writefln("%s", sortedArr[i]); |
| 25 | } |
| 26 | } |
Note: See TracBrowser for help on using the browser.
