HELP PLEASE



Homework #7
Due Wednesday, October 26
Write a program that outputs the following shapes in user-specified sizes:
***** * ***** * ***** ***** * ***** * *****
***** ** **** ** **** * * ** * * ** * *
***** *** *** *** *** * * * * * * * * * *
***** **** ** **** ** * * * * ** * * **
***** ***** * ***** * ***** ***** * ***** *
* * * * * * ********* *********
** ** ** ** *** * * ******* * *
*** * * *** * * ***** * * ***** * *
**** * * **** * * ******* * * *** * *
*** * * *** * * ********* ********* * *
** ** ** **
* * * *
Use functions to decompose the program into simple pieces. For example, there should be individual functions for input and for each of the shapes. There are many other basic components that should be made into functions.
There will be no more outline numbers. Instead, the boxes in the structure chart will all be names of functions. If a function A is “above” another function B, it means that A calls B.
I recommend strongly the following:
• Work first on the main user interface/command loop that allows the user to select a shape, size and solidity. This interface should, using if/else and/or switch, call the appropriate function that outputs each shape. You could work on the user interface by putting temporary simple outputs (like “program got to function square” – these are called “stubs”) into the output functions where you will eventually write the code to print a shape, just so you can verify that the overall command loop calls the appropriate functions. Once the user interface works, you can begin replacing the stubs with working code, one function at a time.
• Note that outputting a shape (which will involve rows and columns) can be compared to the multiplication table, except that the shape only outputs single characters rather than products and a bunch of spacing, borders and such. For the first (rectangular) shape, the primary loop structure is basically identical to that of the table’s “body”. Each shape that follows (in the order I listed them) introduces the need to adjust the ideas used in the previous shapes. Thus, you should work on the shapes in the order presented above and get each one working before proceeding to the next.
If you want an extra challenge, try adding a circle (solid and/or hollow). In this case, the size should be the circle’s diameter. This is very hard to do as rows and columns – it’s much easier to find a different way to view the problem…
The executable program Gold07.exe demonstrates what your program should do, except that it does do circles, which you don’t have to.
You should turn in (in a pocket folder): This assignment/grading sheet, a statement of completeness, a structure chart, and a printout of your program file. All items should be labeled appropriately. You should also place a copy of your main.cpp file (in an appropriately labelled folder) into your private FTP folder. 
Grading Sheet, Homework #7

Name: ________________________________

Criteria Possible Achieved
Statement of Completeness 5
Structure Chart 5
Clear Indentation and Spacing 5
Comments 5
Clear Identifiers 5
Appropriate Use of Statements & Expressions 5
Appropriate Use of Functions 10
Complete/No Errors 5
Output Format and Correctness 5
Presentation 3


Total: 53

Notes:
Last edited on
Down in the text box where you type there is a format group of icons to the right. Highlight the code and the Top Left icon <> will put the proper brackets around your code to display it when you hit submit. If you mess it up you can just hit edit to redo.
Awesome, much easier to read, but I forgot the question. What problem are you having ?

line 59 and 117 both
int numberOfColumns

You only need to put int in front of one. (the first one)

I put lines 119, 120 and 121 on the same line and removed line 117 and your code compiles.
Not sure if it runs or gives the right output.
Last edited on
Topic archived. No new replies allowed.