我已经在 netbeans 上安装了 MinGW,用于 C 和 C++ 编程。
这是我尝试在 netbeans 上运行的简单代码:
#include <stdio.h>
int main(int argc, char** argv) {
printf("Inside Main...\n");
int n;
printf("Enter : ");
scanf("%d", &n); // When I remove this line, it is working.
printf("You have entered %d.", n);
return (1);
}
每当我尝试从 netbeans 控制台访问任何值时,我都看不到任何内容。
使用 scanf(...) 输出
![enter image description here](https://i.stack.imgur.com/IP7SG.jpg)
没有 scanf(...) 的输出
![enter image description here](https://i.stack.imgur.com/lMo8m.jpg)
如果我尝试从 cmd 运行这些代码,所有代码都正常工作
for scanf()
你必须使用Netbeans External Terminal
!
![enter image description here](https://i.stack.imgur.com/dTd8O.jpg)
正常运行
![enter image description here](https://i.stack.imgur.com/jyYYy.jpg)
您还可以使用Netbeans Standard Output
!
但这更具误导性。
当您看到一个空终端时,请进行输入123
![enter image description here](https://i.stack.imgur.com/LH2vr.jpg)
按回车键后,您会立即获得所有输出。
![enter image description here](https://i.stack.imgur.com/0IKBs.jpg)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)