{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw - cin>> side int i = side int j do if(i> 0 j = 0...

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

View Full Document Right Arrow Icon
1. endlendl grendel 2. Prints out a triangle, with legs of length side, starting from top right expanding to bottom left. 3. #include <iostream> using namespace std; int main() { int side; cout << "Enter a number: " ; cin >> side; int j; for ( int i = side; i > 0; i--){ j = 0; while (j < i-1){ cout << " " ; j++; } while (j < side){ cout << "#" ; j++; } cout << endl; } } 4. #include <iostream> using namespace std; int main() { int side; cout << "Enter a number: "
Background image of page 1

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

View Full Document Right 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: ; cin >> side; int i = side; int j; do { if (i > 0){ j = 0; while (j < i-1){ cout << " " ; j++; } while (j < side){ cout << "#" ; j++; } i--; cout << endl; } } while (i > 0); } 5. switch (week){ case 0: cout << "first lecture" ; break ; case 4: case 7: cout << "midterm" ; break ; case 10: cout << "final" ; break ; default : cout << "nothing" ; }...
View Full Document

{[ snackBarMessage ]}

Page1 / 2

hw - cin>> side int i = side int j do if(i> 0 j = 0...

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

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