#include<stdio.h>
void display(char cr, int lines, int width);
int main(void)
{
int ch;//打印字符
int rows, cols;//行数和列数
printf("输入一个字符和两个整数:\n");
while ((ch = getchar()) != '\n')//赋值ch同时;\n做出口
{
if (scanf("%d %d", &rows, &cols) != 2)//输入不等于整数时退出程序
break;
display(ch, rows, cols);
while (getchar() != '\n')
continue;
printf("输入一个字符和两个整数;\n");
printf("输入回车退出.\n");
}
printf("Bye.\n");
return 0;
}
void display(char cr, int lines, int width)
{
int row, col;
for (row = 1; row <= lines; row++)
{
for (col = 1; col <= width; col++)
putchar(cr);
putchar('\n');
}
}