|
CS-182 -- Lab 4: Diamonds Winter Quarter 1999-2000 Electrical Engineering and Computer Science Department CC-27C, 277-7339 PurposeThis lab provides experience using nested loops. AssignmentWrite a program that draws a diamond like the one shown below:
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*
The program should ask the user to specify how many stars should appear on the middle row. If the number is between 1 and 15, the program should draw the appropriate diamond and exit. Otherwise, the program should print an informative error message and continue asking the user to specify how many stars should appear on the middle row until (s)he enters a valid number. Please note that there is a space between each star on a row. Programming consideration: It is always good in program design to consider potential modifications that may be required a some later date. Be sure to keep this in mind when designing your program. Lab report (due 11:00pm, the day prior to week 6 lab)The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:
As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well. If you have any questions, consult the instructor. This page was created by Dr. Christopher C. Taylor, copyright 1999. |