11235 - Pascal's Triangle - Debugging   

Description

In mathematics, Pascal's triangle is a triangular array of the binomial coefficients. The rows of Pascal's triangle are conventionally enumerated starting with row n = 0 at the top (the 0th row). The triangle may be constructed in the following manner: In row 0 (the topmost row), there is a unique non-zero entry 1. Each entry of each subsequent row is constructed by adding the number above and to the left with the number above and to the right, treating blank entries as 0.

 

Image from wikipedia: https://upload.wikimedia.org/wikipedia/commons/0/0d/PascalTriangleAnimated2.gif

 

In this debugging task, a program has been prepared for you (input values are not required). After setting the break points that specified, you have to demonstrate the following things:

  1. Show how this program work.
  2. Predict the new values of pointers.

This program stores a pascal's triangle in a 1D array. The storage is so compact that there is no spaces left. We will first build the triangle by pointers, and then output each row.

Figure out how these things work, and ask the TA to watch your demonstration.

Input

No input are required for this program.

Output

Print the first 5 rows of Pascal's triangle.

Sample Input  Download

Sample Output  Download

Partial Judge Code

11235.cpp

Partial Judge Header

11235.h

Tags

2016F_Lee_Lab5



Discuss