Foreign language phrase tester
This program aids in the learning of a foreign language, by allowing you to translate foreign phrases into your own language, or vice versa. The list of phrases are contained in one or more data files which you specify at the command line.
Programming Issues
The program uses a linked list data structure to store the phrases from the data files, as it is not known at run time how many phrases there will be. The command line arguments must also be parsed to retrieve the filenames of the datafiles to use.
The program uses several "wrapper" functions:
Getline()
which wraps aroundfgets()
, allowing us to ignore lines in the data files which are blank, or contain comments (comments in this case being lines where the first non-whitespace characters is a '#')Rndm()
which wraps aroundrand()
. The constructrand() % n
is not terribly random, especially with the lower order bits, so we write another function to improve it a little.
Usage
Run the program specifying the data files to use as input, e.g.
[paul@localhost paul]$ ./langtest testdata1.dat testdata2.dat
Note that the first two lines of each data file describe the two languages being used; if your data files differ in this respect, the program will behave as if the last data file you specified on the command line contains the correct information.