69,369
社区成员
发帖
与我相关
我的任务
分享
fflush(stdin);// here 要清理输入的缓冲区,要不然下次输入就会出现你这样的错误
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
int main()
{
while(1){
char buf[5];
int e1, e2;
printf("\n操作:");
fgets(buf, 5, stdin); //这里有问题吗???
if( !strcmp(buf, "save")){
printf("save\n");
}
printf("页号:");
scanf("%d", &e1);
printf("页内地址:");
scanf("%d", &e2);
fflush(stdin);// here
}
return 1;
}