#include<stdio.h>
void desplay(char cr, int line, int col);
int main()
{
char ch,m;
int line, col;
printf("请输入字符,列数,行数");
while ((ch = getchar()) != '\n')
{
scanf_s("%d %d", &line, &col);
desplay(ch,line, col);
printf("你可以再次输入");
while (getchar() == '\n')
continue;
}
printf("bye");
return 0;
}
void desplay(char cr, int line, int col)
{
int lines, cols;
for (lines = 1; lines <= line; lines++)
{
for (cols = 1; cols <= col; cols++)
putchar(cr);
printf("\n");
}
},必须写成while(getchar()!='\n',为什么是这样的,不然如果有换行符,就忽略呀,请解释一下
while (getchar()=='\n'),为什么,不可以呀?缓存区有个\n,进入循环,contiune,忽略掉就可以了呀,请解释一下,我理解错在哪里