hw - if(side < 0) { return 0; } int x = 0; do { x++ for...

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

View Full Document Right Arrow Icon
1. endlendl grendel // note there is no an endl that starts a new line after “grendel” 2. It prints a picture of a right triangle. 3. #include <iostream> using namespace std; int main() { int side; cout << "Enter a number: "; cin >> side; for (int i = 0; i < side; i++) { int x = 0; while(x < i) { cout << '#' << x << endl; x++; } } }
Background image of page 1

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

View Full DocumentRight Arrow Icon
4. #include <iostream> using namespace std; int main() { int side; cout << "Enter a number: "; cin >> side;
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if(side < 0) { return 0; } int x = 0; do { x++ for (int j = 0; j <= i; j++) { cout << '#'; } cout << "\n"; while (x < side - 1) } } 5. switch (year) { case 2003 : cout << Schwarzanegger; break; case 1998 : cout << Davis; break; case 2010 : cout << Who knows?; break; case 1990 : case 1994 : cout << Wilson; break; default : cout << Someone; }...
View Full Document

This note was uploaded on 12/03/2010 for the course CS programmin taught by Professor Hill during the Spring '10 term at Bank Street College of Education.

Page1 / 3

hw - if(side < 0) { return 0; } int x = 0; do { x++ for...

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

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