in code is input for number.
but I need to enter the input "letter" to have same result.
pls help mee.
to input letter and to have this result"
a
aba
abcba
language: c++
#include <iostream>
using namespace std;
int main()
{
int i, j;
char alph = 'A';
int n, blk;
int ctr = 1;
cout << "nn Display the pattern like pyramid using the alphabet:n";
cout << "---------------------------------------------------------n";
cout << " Input the number of Letters (less than 26) in the Pyramid: ";
cin >> n;
for (i = 1; i <= n; i++) {
for (blk = 1; blk <= n - i; blk++)
cout << " ";
for (j = 0; j <= (ctr / 2); j++)
{
cout << alph++ << " ";
}
alph = alph - 2;
for (j = 0; j < (ctr / 2); j++)
{
cout << alph-- << " ";
}
ctr = ctr + 2;
alph = 'A';
cout << endl;
}
}
in code is input for number.
but I need to enter the input "letter" to have same result.
pls help mee.
Source: Windows Questions C++