Project information
- Category: C/C++
- Project URL: https://github.com/rafarc97/pyramid-builder
Pyramid Builder
This is a program developed in C++ that takes a list of integers as input and builds a pyramid from those values. The pyramid is constructed by sorting the integers in ascending order from top to bottom and from left to right, with empty spaces filled with zeros. To make the pyramid symmetric, the input numbers are alternated with zeros. The program will calculate the number of rows and columns required to build the pyramid based on the length of the input list. It will then determine where to place the integers and zeros in the pyramid, following the required sorting and alternating pattern. If it is not possible to build a pyramid using the input list, the program will raise a "CannotBuildPyramidException" to indicate the error. The output of the program is a 2D array representing the pyramid constructed from the input values. The program includes unit tests with examples to ensure the correct functioning of the code.