- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的代码工作得很好。但是,当我尝试调试它时,因为这是我第一次使用 Luna Eclipse,并且想了解调试过程是如何工作的,它给了我一个错误,说
*stopped,reason="end-stepping-range",frame={addr="0x00401479",func="main",args=[],file="..\src\Assignment1A.c",fullname="C:\Users\Sunghee\workspace2\Assignment1A\src\Assignment1A.c",line="37"},thread-id="1",stopped-threads="all"
我不明白这一点,因为当我运行它时它工作得很好。错误出现在我的第一个 if 语句处
printf("\n%d + %d =%d", num1, num2, ans);
if (num2 > 0) {
printf("\n%d / %d = %d", num1, num2, num1 / num2);
printf("\n%d %% %d = %d", num1, num2, num1 % num2);
}
else {
printf("\n%d /%d is not allowed", num1, num2);
}
谁能告诉我为什么?我已经研究过它,但所有我不理解的术语...对我不起作用:p 谢谢!
当我运行它时,它可以在 Eclipse 中运行。当我逐行调试它时,错误发生在上述一行之后。完整代码:
int main(){ 整数 num1;//用户输入的第一个数字 整数 num2;//用户输入的第二个数字 整数答;//存储数学结果的变量
setbuf(stdout, 0);
printf("Please enter the first integer:\n");
scanf("%d", &num1);
printf("Please enter the second integer:\n");
scanf("%d", &num2);
ans = num1 + num2;
printf("\n%d + %d =%d", num1, num2, ans);
if (num2 > 0) {
printf("\n%d / %d = %d", num1, num2, num1 / num2);
printf("\n%d %% %d = %d", num1, num2, num1 % num2);
}
else {
printf("\n%d /%d is not allowed", num1, num2);
printf("\n%d %% %d is not allowed", num1, num2);
}
printf("\nThe average of %d and %d is %d", num1, num2, (num1+num2)/2);
return 0;
}
所以如果有人可以帮忙,请帮忙!正如我所说,我运行时没有问题。但我想知道为什么我调试的时候会出现错误。出于好奇:D
最佳答案
下面的代码对我来说工作得很好。我认为这与你初始化变量的方式有关。如果可能的话,请您分享整个代码。
#include <stdio.h>
int main(void) {
int num1 = 1,num2 =2,num3 = 3,ans =0;
printf("\n%d + %d =%d", num1, num2, ans);
if (num2 > 0) {
printf("\n%d / %d = %d", num1, num2, num1 / num2);
printf("\n%d %% %d = %d", num1, num2, num1 % num2);
}
else {
printf("\n%d /%d is not allowed", num1, num2);
}
return 0;
}
结果
1 + 2 =0
1 / 2 = 0
1 % 2 = 1
关于c - 代码中没有错误,但是当您调试时,我收到错误(Eclipse Luna),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31634509/
我尝试了互联网上的所有解决方案但没有结果,我的 eclipse 似乎无法连接到互联网,每次我尝试安装新软件时我都会收到错误消息: 无法读取位于 http://download.eclipse.org/
使用 Eclipse 版本:Luna Service Release 1 (4.4.1) -- 以 CDT 包为基础 -- 使用 pacman/yaourt 在 /usr 下安装大多数软件包,我无法持
我最近从 Indigo“升级”到了 Luna(Oracle OEPE 安装)。请注意围绕“升级”一词的引用。 不幸的是,事情很慢。 我使用的项目是一个 Maven 多模块项目。构建工作区操作大约需要
我的 Eclipse 主题似乎有问题。我使用它附带的标准深色主题,并且还使用颜色样式来更改背景/文本颜色。我有 Luna 版本。 即使它确实接受更改,如果我在重新启动 Eclipse 时点击“应用”和
快速搜索命令似乎在露娜中消失了。在 Keplar 中,默认绑定(bind)为 Ctrl+Shift+L。在 Luna 中,Ctrl+Shift+L 会显示当前键绑定(bind)的列表,这是 Kepla
我不能在 eclipse mars 中使用默认存储库。例如 http://download.eclipse.org/eclipse/updates/4.5/ .代理没有问题。我可以联系http://d
每当我在代码中遇到断点时,我都会看到一个令人讨厌的对话框,通知我“透视切换作业遇到问题”,其详细信息只是简单地说“NullPointerException”。错误日志显示此堆栈跟踪: java.lan
我目前正在将 64 位 Kepler 与 IBM Websphere Developer Tools 一起使用,但它运行速度很慢。 eclipse 进程经常使用 800M - 1.2G 并且它不时卡住
我正在使用Eclipse Luna和Eclipse Luna的Gradle插件(使用来自Pivotal的Gradle IDE Pack 3.6.x)。我创建了一个具有Gradle支持的简单Java项目
我下载了新的 Eclipse Luna(4.4 版)并更改为深色主题,但代码编辑器没有变化。请参阅屏幕截图: 我在 MAC、Windows 和 Linux 上尝试过此操作,结果始终相同。 最佳答案 好
我目前正在尝试为 FreeMarker 设置 Eclipse Luna。我已经安装了 JBoss 提供的 FreeMarker IDE:http://download.jboss.org/jbosst
我只需单击帮助 -> 检查更新并完成向导,然后收到以下错误: An error occurred while collecting items to be installed session cont
Eclipse Luna 终于有了这个很棒的分割编辑器,但我无法弄清楚如何使我们的编辑器按照新功能的预期工作。我们有自己的自定义编辑器,它在拆分时的行为与 Luna 中的 Java 编辑器不同。在自定
我目前正在尝试为 FreeMarker 设置 Eclipse Luna。我已经安装了 JBoss 提供的 FreeMarker IDE:http://download.jboss.org/jbosst
这个“解决方案”在 Luna 版本中看起来不再有效: Copy path/file name in Eclipse to clipboard 这实际上是一个丰富的 IDE 必须具备的功能! 最佳答案
当我在 eclipse Luna 中导入或尝试创建项目时,出现以下错误: Errors occurred during the build. Errors running builder 'Java
我从 eclipse.org 下载了 Eclipse Luna 4.4 。我更改了 general > Appearance > theme => dark 上的主题。但这不是我想要的。 现在 应该(
我想将 EclipseLink 库添加到我的项目中。为此,我去了 eclipse market 并安装了 eclipse link 2.5 kepler。我的 Eclipse IDE 是 luna,它
我是 eclipse ide 用户的初学者。请任何人 1 帮助我如何通过示例在 Eclipse 层次结构中链接 mvc 模式。创建项目后,在 src/文件夹下创建一个必要的文件,并向我展示使用登录功能
每当我单击 Eclipse Luna 中的任何项目或任何 jsp 页面或 java 文件时,都会抛出“空指针异常”。自从我尝试安装 Angular js 插件以来,就出现了这个问题。我不明白问题是什么
我是一名优秀的程序员,十分优秀!