I have it so my program prints out the alphabet, but i need it so the "A" is in the middle of the shape and it branches out. What change do I need to make so that's possible?
nclude <iostream>
using namespace std;
int main ()
{
int N ;
do
{
cout << endl << "Please enter an odd integer, 1 - 51 : " ;
cin >> N ;
if( N < 1 || N > 51 || N % 2 == 0 )
cout << "Invalid number." << endl;
}
while( N < 1 || N > 51 || N % 2 == 0 );
cout << endl ;
int amount_letters = N;
int amount_spaces = 0;
for (int i=0; i < N ; ++i)
{
for (int j=0; j < amount_spaces; ++j)
cout << ' ';
for (int k=0; k < amount_letters ; ++k)
cout << char ( k + 65 );
if( i < N/2 ) // top half of the hourglass
{
amount_letters -= 2;
amount_spaces += 1 ;
}
else // bottom half of the hourglass
{
amount_letters += 2;
amount_spaces -= 1 ;
}