Chapter 9

A3:

Every space will count as one word. Two possible modification schemes are to peek at the next character (this is tricky to do correctly) or to remember the last character seen (more straightforward).

A4:

Yes, the function scanf could match spaces between words.

A5:

Could you test either for a null up through the last cell of the buffer or for reaching that last cell without finding a null?

A6:

If the first string is ONE and the second is ON, that test would not trigger the necessary swap to move ON before ONE.

A7:

SORTSTR as written would need 10 traversals, each involving 7 instructions.

A8:

Perform a range check (A Z) on a scratch copy of each character, and then force those copies either to uppercase or to lowercase before the equivalent of the instruction at the label why. Doing that will make like words be adjacent, but not always in the same kind of ordered relationship from instance to instance. Why not?

A9:

The long dashes. Anything else?

A14:

Begin by converting all characters to lower case.

A15:

Since you will be using the C functions for I/O, you could pretest your ideas for logic to handle the various EOF situations by writing a C program first.

A16:

For lincoln.txt in order of word length, starting with one letter: 7, 50, 54, 57, 33, 27, 15, 6, 11, 4, 3.



ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ItaniumR Architecture for Programmers. Understanding 64-Bit Processors and EPIC Principles
ISBN: N/A
EAN: N/A
Year: 2003
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net