Cmpsc 101, Project : Sorting
Write a program ( filename : sort_YourID.pl ) which :
- reads numbers from a data file ( filename : sorting.dat ). This file
should contain a single number per line. The number of lines/numbers
is arbitrary. Numbers can be negative, zero,
or positive and the same number may occur multiple times.
- sort the numbers like mathematicians would in increasing order.
For mathematicians -10 is less than -5 which itself is less than
than 0. On the other hand 0 is less than +5 which in turn is less
than +10.
- print to standard output ( the monitor ) the sorted numbers
In order to write this program you need knowledge of :
- if-elsif-else statements
- while-loop
- Reading from a file
- Using arrays
Zig Herzog; hgn@psu.edu
Send a Note to Zig
Last revised: 10/20/04