April 2003
Intermediate to advanced
576 pages
15h 13m
English
As a second example of working with files, we present a companion to the SORTSTR program, which performed a bubble sort on strings entered interactively. The SORTINT program (Figure 9-6) reads integer quantities from an ASCII text file into internal binary storage as quad words, sorts them using the bubble sort algorithm, and writes the ordered list of signed integers to a new text file, one per line. This program utilizes I/O features of the SCANFILE program to implement the bubble algorithm of the SORTSTR program.
// SORTINT Bubble sort integers from a file // This program will read 100 or fewer integers from a // text file, sort them using the ... |