CS2134_HW4

CS2134_HW4 - HOMEWORK #4 CS2134, Fall 2007 Due 11:59 p.m....

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

View Full Document Right Arrow Icon
HOMEWORK #4 CS2134, Fall 2007 Due 11:59 p.m. Monday 10/29 Instructions: Submit the programming part in a single file called hw04.cpp. Submit the written part in a single file called hw04written.xxx, where xxx indicates the file format. The program for the programming part is short, but you will need to think before writing. Make sure to leave enough time to do the written part -- it is longer than usual. Programming Part: Consider the following triangle (we will call this an upside-down triangle): *************** ************* *********** ********* ******* ***** *** * Observation: If I remove the first row, the remainder is also a triangle of the same shape, except that its height is reduced by one, and it is indented one position. ************* *********** ********* ******* ***** *** * Using the above observation, write a recursive function print_up_tri(int i, int n) that prints an upside down triangle with n rows, indented by i positions. (How many asterisks should be in the top row?) For example, print_up_tri(2, 6) should print
Background image of page 1

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

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

This note was uploaded on 05/18/2008 for the course CS 2134 taught by Professor Hellerstein during the Fall '07 term at NYU Poly.

Page1 / 3

CS2134_HW4 - HOMEWORK #4 CS2134, Fall 2007 Due 11:59 p.m....

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