A B C 5$$$$ $$$$5 $$$$$ $5$$$ $$$5$ 5$$$$ $$5$$ $$5$$ 55$$$ $$$5$ $5$$$ 555$$ $$$$5 5$$$$ 5555$
You will ask the user to input the size of the box and also the character you should use to display the pattern.
For the size, you should only allow the user to enter a number between 2 and 9, inclusive. So, 1, for example, is not a valid size. You should error check the input and allow the user to keep entering numbers until he/she enters a number in the correct range. See the sample output below.
After getting the user input, you must present a menu to the user. The menu should have four options. Each option will perform a different task.
linux3[39]% gcc -ansi -Wall proj2.c linux3[40]% a.out This program prints boxes in three different patterns. The user must specify the size of the box and also the character with which to print the box. Depending on the pattern, the box will be printed with some combination of the character and also the number corresponding to the size. The user will be presented with a menu listing the three pattern options shown below: A, B, and C. The following example shows the patterns for a box of size 5 (5 rows and 5 columns) and the character '$' A B C 5$$$$ $$$$5 $$$$$ $5$$$ $$$5$ 5$$$$ $$5$$ $$5$$ 55$$$ $$$5$ $5$$$ 555$$ $$$$5 5$$$$ 5555$ Please enter the size: -5 Invalid size. Must be between 2 and 9. Enter the size: 10 Invalid size. Must be between 2 and 9. Enter the size: 0 Invalid size. Must be between 2 and 9. Enter the size: 5 Please enter the character: $ A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: a 5$$$$ $5$$$ $$5$$ $$$5$ $$$$5 A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: B $$$$5 $$$5$ $$5$$ $5$$$ 5$$$$ A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: c $$$$$ 5$$$$ 55$$$ 555$$ 5555$ A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: q Have a nice day! linux3[43]% a.out This program prints boxes in three different patterns. The user must specify the size of the box and also the character with which to print the box. Depending on the pattern, the box will be printed with some combination of the character and also the number corresponding to the size. The user will be presented with a menu listing the three pattern options shown below: A, B, and C. The following example shows the patterns for a box of size 5 (5 rows and 5 columns) and the character '$' A B C 5$$$$ $$$$5 $$$$$ $5$$$ $$$5$ 5$$$$ $$5$$ $$5$$ 55$$$ $$$5$ $5$$$ 555$$ $$$$5 5$$$$ 5555$ Please enter the size: 4 Please enter the character: * A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: a 4*** *4** **4* ***4 A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: b ***4 **4* *4** 4*** A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: C **** 4*** 44** 444* A - Pattern A B - Pattern B C - Pattern C Q - Quit Enter your menu selection: Q Have a nice day! linux3[44]%
Here is a sample submission command. Note that the project name starts with uppercase 'P'.
linux3[45]% submit cs104 Proj2 proj2.c
To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command.
linux3[46]% submitls cs104 Proj2