// triangles.cpp
// Displays a pattern consisting of spaces
// and a character entered by the user.
// Demonstrates nested loops.
#include <iostream>
int main()
{
cout << "Enter a character:>";
char typed;
cin >> typed;
for ( int row = 0; row < 5; row++ )
{
for ( int column = 0; column <= row; column++ )
cout << typed;
for ( int column = 0; column < (5 - row); column++ )
cout << ' ';
cout << " ";
for ( int column = 0; column <= (5 - row); column++ )
cout << typed;
cout << " ";
for ( int column = 0; column <= row; column++ )
cout << typed;
cout << " ";
for ( int column = 0; column < row; column++ )
cout << ' ';
for ( int column = 0; column <= (5 - row); column++ )
cout << typed;
cout << endl;
} // for row
return 0;
} // function main