// email : shinshiten_ryu@rocketmail.com
# include <iostream.h>
int main ()
char letter; // letter is the symbol or letter made into a giant triangle
while(cin) // This allows the program to loop until the user closes the window
cin>>letter;
cout<<"Enter the number of characters the base should have."<<endl;
cin>>base;
width = (base / 2) + 5 - counter; // This is how far into the center it should space until it starts
outputting the symbol
a = 1; // a is how many lines down the triangle is, and natuarally it starts on
the first line
while(width > 5) // It will loop and continue to output the symbol until it reaches 5 spaces
from the left margin...
width = (base / 2) + 5 - counter; // This is how far into the center it should space until it starts
outputting the symbol
cout<<setw(width); // setw is an output manipulator in the <iomanip.h> library. this tell the
compiler how many lines
// to move until it first sends a character to the screen. It is currently set to move
the value of
while(b > 0) // This while loop will continue to output the desired symbol to the current line
until it is equal to 1
cout<<endl; // an endl is used to jump to the next line to output the next part of the
triangle
b = (a * 2) - 1; // the number of symbols per line is found using this equation
b = b + 2; // b is given 2 more symbols because it is on the next line, and every line has 2
more than the previous
counter++; // the counter is used to ensure proper spacing done by the width variable
cout<<endl<<endl; // endl is used to add some space between each time the program is
executed
return 0;