you are doing a ton more work and logic than necessary making it harder to debug etc.
1 2 3 4 5 6 7 8 9 10
string d ="54321";
string a = "ABCDE";
char * lazy = &(d[0]);
for(int i = 0; i < 5; i++)
{
cout << lazy << a[i]<<endl;
lazy++;
}
granted, some patterns you do need to generate, and knowing how is useful. You need both: the ability to loop and generate when you need to and the ability to NOT do all that when the pattern is simplistic.
your way, fixed:
1 2 3 4 5 6 7 8 9 10 11 12
int i, j, k;
char magic_letter = 'A';
for(i=5;i>=1;i--)
{
for(j=i;j>=1;j--)
{
cout<<j;
}
cout<<magic_letter++<<endl;
}