//Nathan Dominguez CSC5 Chapter 5, P. 298, #23
//
/******************************************************************************
*
* Display Two Patterns
* _____________________________________________________________________________
* This program uses loops to display a 2 types of pyramids. The first loops
* creates Pattern A. The second loop creates the inverse of Pattern A labeled
* Pattern B.
* _____________________________________________________________________________
* INPUT
* lengthPyramid : Variable for pyramid size
* display : Variable of display character
* countRowPyramid1 : Variable for lines in first pyramid
* countRowPyramid2 : Variable for lines in second pyramid
* lineLoop : Variable to loop lines
*
* OUTPUT
* display : Display character which is +.
*
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
// Declare Variables
int lengthPyramid = 10; // Variable to hold size of the Pyramid
char display = '+'; // Display Character of '+' for Pyramid
cout << "Pattern A:" << endl;
//
//Loop for first pattern
for(int countRowPyramid1 = 0; countRowPyramid1 <= lengthPyramid; countRowPyramid1++)
{
cout << "\t";
for(int lineLoop = 0; lineLoop < countRowPyramid1; lineLoop++)
{
cout << display;
}
cout <<endl;
}
//
//Loop for second pattern
cout << endl << "Pattern B:" << endl << endl;
for(int countRowPyramid2 = 10; countRowPyramid2 >= 0; countRowPyramid2--)
{
cout << "\t";
lengthPyramid = countRowPyramid2;
for(; lengthPyramid > 0; lengthPyramid--)
{
cout << display;
}
cout <<endl;
}
return 0;
}