Lab6 - rows between the top star and the middle row and the...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
ENG101 Lab Exercise 6 September 30 th and October 1 st Iteration: Drawing Concepts: Using iterations in order to draw a picture Use for or while loops in order to create an output on the screen that looks like this: * *** ***** ******* ********* *********** ************* *************** ***************** ******************* ***************** *************** ************* *********** ********* ******* ***** *** * Hint: Use each row as an iteration. Within each row iteration, you can use a few iterations that outputs spaces and *’s in the appropriate amounts. I suggest that you calculate the number of spaces and *’s in each row as a function of the row number before you start coding. The size of the diamond should be user inputted. The user should input the number of
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: rows between the top star and the middle row and the program should draw the corresponding size diamond. For example, the picture on this page is a diamond of size 10. The skeleton of the code is given on the following page. #include <iostream> using namespace std; void drawTriangle(int); int main() { int rows; cout << "What is the size of the diamond: "; cin >> rows; cout << endl << endl << "Here is the diamond: " << endl << endl; drawTriangle(rows); return 0; } void drawTriangle(int rows) { // this is the hard (fun) part } Mind Challenge: Can you think of other cool and interesting things that you can draw using iterations?...
View Full Document

This note was uploaded on 05/16/2010 for the course ENGR 101 Sectio taught by Professor Ringenberg during the Fall '08 term at University of Michigan.

Page1 / 2

Lab6 - rows between the top star and the middle row and the...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online