用户提问
#include
#define PPT 27
int main(void)
{
char max[PPT];
int cas=0,i=0;
int gps=0;
while(cas++
scanf("%c",&max[i]); // fflush(stdin);完全不管用!我用的是gcc fflush(stdin);不管用(而且这方法也是错的)
while(gps++
printf("%c",max[i++]); // 系统把回车也算到PPT里面了 所以只能输入14次就停了,这说法对吗?
return 0;
} 跪这等回答!
字是我自己在这里打进去的 所以跑到下一行了!(无视就好)
推荐答案
#include
#define PPT 27
int main(void)
{
char max[PPT];
int cas;
for(cas=0;cas
scanf("%c",&max[cas]); // 你用这种方法时,i是没有变化的,所以只能存储一个字符max[0]
for(cas=0;cas
printf("%c",max[cas]); //
return 0;
}
关于标题的问题,scanf函数读入的是获取单词而不是字符串,所以他不会添加空字符,而且他是