老师想问您一下第六题可以直接使用while((ch=getchar())!='\n')来开启循环么,
还是要用
scanf("%c",&ch)
ch=getchar()
while(ch!='\n')
第一种情况只给了80分
You have no rights to post comments
Comments
// Initialize a empty array
char str[100] = {};
// Get input from stdin
fgets(str, 100, stdin);
学会不用数组的解题方法。
当然可以。没得满分说明还是有逻辑错误。
scanf("%c",&ch)
ch=getchar()
这两个重复了,先scanf读入一个,再getchar读入一个。前一个就丢了。