CSCI 116 Programming
Project #11
Purpose: To begin working with arrays and strings, to write a
program that is more than 20 lines long, and to get more practice with functional
abstraction (as well as to write a really cool Pig Latin translator).
Assignment: You are to write a
program that translates English to Pig Latin.
In case you have forgotten, the way you translate English to Pig Latin
is to use the following rules:
Here are some
examples:
Your program
should prompt the user to enter a sentence.
It should read that sentence into an array, and echo the sentence back
again. It should then translate the
sentence to Pig Latin and print out the resulting translation. This process should then repeat. To terminate the program the user should type
the word exit, using any type of capitalization.
Here is a
sample run:
Pig Latin
translation program
Enter a sentence
to translate to Pig Latin (“exit” to quit):
Help, I’m being held
prisoner in a Chinese fortune cookie factory.
The sentence:
Help, I’m being
held prisoner in a Chinese fortune cookie factory.
translates to Pig
Latin as:
Elphay, I’mway eingbay eldhay isonerpray inway away Inesechay ortunefay ookiecay actoryfay.
Enter a sentence
to translate to Pig Latin (“exit” to quit):
Exit
Exitingway...ankthay ouyay orfay usingway isthay ogrampray.
Programming Style: Your program should follow all the style
guidelines given in the first programming assignment.
Getting Started: To get started, get the I/O working
first, so your program reads a sentence into an array, prints it out again, and
exits at the right time. Then work on
your Pig Latin translator. You might
want to take advantage of some of the character functions we’ve discussed
before, such as tolower, isalpha,
and so on.
Turn in: You should turn in a listing of your program, with the
output it generates for a sample run included as comments at the end of the
source file.
Background: For those of you who might be wondering, here is a history
of Pig Latin. I knew it was
authoritative since I found it on the web! J
Most definitely, Pig Latin
is a language in and of itself. It was used in southern