带有scanf的程序在NetBeans中无法正常工作 [英] Programs with the scanf not working properly in NetBeans

查看:72
本文介绍了带有scanf的程序在NetBeans中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天已经安装了NetBeans 7.0.1,当我尝试使用其中的"scanf"执行C程序时,会出现奇怪的错误

I've installed NetBeans 7.0.1 today When I try to execute C program with "scanf" in it it's giving strange errors

这是我写的:

它一直运行,直到我在输出控制台中输入内容为止.

It keeps on running until I enter something in the output console.

输入后,将显示printf语句并显示"RUN FAILED"

After entering its shows the printf statement and shows "RUN FAILED"

有人可以告诉我该怎么做吗?

Can anybody tell me what should I do to make this right?

推荐答案

您的printf不会被刷新,因此在程序结束之前不会显示.

Your printf is not getting flushed so it is not showing until the program ends.

您没有从main()中显式返回值,因此将返回scanf()的结果,该结果为1,这被解释为程序失败.

You are not returning a value from main() explicitly, so the result of scanf() is being returned, which is 1 which is interpreted as program failure.

这篇关于带有scanf的程序在NetBeans中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆