在写应用程序的时候,我同时使用文件读入,fopen(有写 fclose), 和键盘读入 scanf,请问为什么当重新返回键盘读入的页面时,旧读入还在(system("cls") 后)而且会影响新读入,我该怎么修改代码?
void play_game()
{
system("cls");
move(0, 0);
……
printf("请输入您要挑战的关卡编号\n");
while (1)
{
scanf("%d", &playing);
if (playing > lev)
printf("本关卡未解锁。\n");
else break;
}
……
while (true)
{
if (check() == false) break;
print_graph();
for (short i = 1; i <= 4; ++i)
{
update_plane();
Sleep(slp);
}
if (GetKeyState(27) < 0)
break;
}
print_point();
to_problem_set();
}