【发布时间】:2017-05-25 11:41:28
【问题描述】:
首先还有另一个同名的问题,但那里提供的解决方案对我不起作用。 Other question
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, c;
fflush(stdout);//suggested solution in other question
scanf("%d%d%d", &a, &b, &c);
printf("Values entered: %d %d %d\n", a, b, c);
return 0;
}
当我正常运行时,代码运行良好。
输出
1 2 3
Values entered: 1 2 3
但是当我在调试模式下运行时,什么都没有打印出来。当我将鼠标悬停在变量上时,它们具有这些值。
一个:56
b : 6422420
c : 6422420
建议的另一个解决方案是将此代码放在 main 方法的开头。
int ch;
while ((ch = getchar()) != '\n' && ch != EOF); //suggested solution #1
帖子中建议的两种解决方案都不适合我。我分别尝试了它们。
编辑
操作系统:Windows 10
编译器:MinGW
【问题讨论】:
-
什么编译器(Eclipse 不是编译器)以及您使用的是什么操作系统?
-
我建议在命令行上编译。 Eclipse 只是对你隐藏了一些东西。
-
C 和 C++ 是不同的语言,在询问您的程序时不要同时指定两者。