Project: The Pig Latin Program

Your goal this chapter is to write another simple and fun program. This program replicates a silly word game that is very popular with children. The user types in a phrase, and the program calculates the pig latin translation of that phrase. In case you’ve forgotten, pig latin uses a simple formula to make an English word sound like a Latin word: If the word begins with a vowel, you add way at the end of the word. If the word begins with a consonant, you move the consonant to the end of the word and add ay. Look at the program in Figure 3.1 to see an example.

Figure 3.1. The title of this book sounds very classy when translated into pig latin.


The Pig Latin program utilizes a couple features that have not been covered yet in this book, such as text manipulation and repetition. Obviously, the program uses techniques for manipulating text. C# supplies many interesting ways to work with text values, which you will learn about in the next section. Also note that the program repeats in two ways. First, it continues to prompt for a new phrase until the user types in quit. Also, it does the appropriate manipulation to each word in the phrase. Somehow, the program knows how many words are in the phrase. Read on, and you will learn about this and a little more.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.21.12.140