Linguistics 408/508 |
Fall 2003 |
Hammond |
Handout 6
Overview
- Questions from last time
- String tests
- Practice
String tests
-
eq
: string equality, are two strings the same?
-
ne
: string inequality, are two strings different?
-
lt
: alphabetic order, does one string preceed another
alphabetically?
-
gt
: alphabetic order, does one string follow another
alphabetically?
Practice in groups
- Write a program that prints out its command-line arguments, each on a
separate line
- Write a program that adds together a set of numbers given on the
command-line and prints out the result.
- Write a program that reads a bunch of lines in from a file and then:
- prints them out in reverse order
- prints out every other one
- prints out every nth one, where n is given on
the command-line
- Write a program that takes a list of words on the command-line and
finds the first one alphabetically.
-
Hard: write a program that takes a list of words on the
command-line and sorts them alphabetically.