Submit the source code & output for each program using the Homework Template
Submit your .docx file on eCampus
 

1. Write a program called name.cpp that allows a user to enter their names, then print out their name properly formatted:

Program 2 Example Output

Please enter your first name: David
Please enter your last name: Kirk
Please enter your middle name: Gecko
Are you male or female (m/f)? m

Your formatted name is: Mr. David G. Kirk


2. Create a text file named lotto.txt that contains all numbers chosen for Lotto Texas since the contest began in 1992.  Write a program named lotto.cpp that reads these numbers and prints the total numbers, their sum, and their average.  You do not need to turn in the lotto.txt file containing the numbers.

Program 1 Example Output

Statistics for Lotto Texas (1992 - present)
Total numbers: _____
Sum of these numbers: _____
Average of these numbers: _____
 

Extra Credit: Calculate the frequency of each number 1 - 54


3. Write a program called quickpick.cpp that prints a random quick pick for Lotto Texas.  The quick pick should have six numbers in the range (1 - 54) and there cannot be duplicate numbers.  Your program should also print a random "Good Luck" statement (from a list of at least 5).

Program 3 Example Output

Here is your Lotto Texas quick pick: 12 8 35 30 52 42
May the ping-pong balls fall in your favor!


4. Write a program called palindrome.cpp that allows the user to enter a word.  It then prints the word in reverse, then informs the user whether or not it is a palindrome.

Program 4 Example Output

This program is used to detect a palindrome.
Please enter a word: Hello
Your word in reverse: olleH
This word is not a palindrome.

Extra Credit: Make your program work with palindrome sentences.  For example:
A man, a plan, a canal: Panama.