If-else语句 [英] If-else statement

查看:83
本文介绍了If-else语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用if-else语句编写一个程序,该程序将打印出输入程序的正数和负数之和。当我运行程序时,它打印出极大的数字。知道为什么吗?

I''m trying to use if-else statements to write a program that will print out sum of positive and negative numbers that are input into the program. It prints out extremely huge number when i run the program. Any idea why?

推荐答案

这可能有几个不同的原因,但我猜你使用的变量是未定义的,或者是未定义的行为。我们可以在主语句中看到代码吗?
There could be a few different reasons for this, but I''m guessing that a variable you use is undefined, or goes through undefined behavior. Can we see the code inside your main statement?


我想id只发布整个代码....

i figured id just post the whole code....

展开 | 选择 | Wrap | 行号


你学习了循环了吗?说实话,这是不必要的长,并且可以通过循环大大简化。
Have you learned about looping yet? This is, to be honest, unnecessarily long, and could be simplified greatly with a loop.


这篇关于If-else语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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