作者ho83leo (LWHo)
看板C_and_CPP
标题[问题] gcc 编译器问题
时间Tue Dec 15 00:54:46 2015
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
gcc 4.9.2 and 4.9.3 and 5.2.0
linux gcc 4.9.2
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
在windows 10 x64 安装了 cygwin x86(因IDE因素所以上x86),
刚刚windows 编译的时候, 可以安全safe, 但是印出後 却是很长一段数值,
可是加总後的总数却是正确的...
喂入的资料(Input):
五个参数 8 6 3.0 0.2 1.0
预期的正确结果(Expected Output):
在linux 执行结果为图
https://goo.gl/4Xqcj9
错误结果(Wrong Output):
windows 10 cygwin x86 gcc 4.9.2 / 4.9.3 / 5.X.X 都同样错误结果
https://goo.gl/tdyNCH
程式码(Code):(请善用置底文网页, 记得排版)
http://codepad.org/dOURJdAZ
补充说明(Supplement):
求各位大大解惑也!!!
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 120.102.146.202
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1450112090.A.84F.html
1F:推 LPH66: 你的 total 一开始没有归零, 後来是对的是因为 32 行归零了 12/15 01:24
2F:→ LPH66: 只宣告没给初值的变数其内容不可预测 12/15 01:25
3F:→ ho83leo: 感谢解答... 犯这种错误真是粗心 12/15 09:34