2099. Simple printing graphics

Title description

Print graphics

enter

Enter a row, which contains two integers n and m, respectively representing the number of rows and columns of the graphics you want to output.
1 <= n, m <= 26.

Output

Output printed graphics

Sample input

5 7

Sample output

ABCDEFG
BABCDEF
CBABCDE
DCBABCD
EDCBABC

Code content

#include <iostream>
using namespace std;

int main()
{
    
    
	int n, m, i, j;
	char a, b, c;
	cin >> m >> n;
	for (i = 0; i < m; i++)
	{
    
    
		j = i;
		a = 'A'+i;
		while (j--)
		{
    
    
			cout << a;
			a--;
		}
		b = 'A';
		for (j = 0; j < (n - i); j++)
		{
    
    
			cout << b;
			b++;
		}
		cout << endl;
	}
	return 0;
}   

Guess you like

Origin blog.csdn.net/weixin_51800059/article/details/111402111