[问题] 排列数字有误(已解决!

楼主: jerryhey (jerryhey)   2022-01-18 16:17:21
开发平台(Platform): (Ex: Win10, Linux, ...)
Win10
编译器(Ex: GCC, clang, VC++...)+目标环境(跟开发平台不同的话需列出)
c++
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
问题(Question):
在排列数字的时候找不到正确的值
喂入的资料(Input):
56 89 67 101
预期的正确结果(Expected Output):
89 67 56
错误结果(Wrong Output):
101 0 0
程式码(Code):(请善用置底文网页, 记得排版,禁止使用图档)
https://ideone.com/h9JHp5
补充说明(Supplement):
排列数字的时候有错
找不到原因
最大值都是101
往下排列数字都是0
阿不然就是溢位(-85640)
麻烦各位帮我debug~~~感恩
作者: nh60211as   2022-01-18 18:28:00
大概把a删掉改用count就差不多了
作者: sarafciel (Cattuz)   2022-01-18 19:24:00
你的count++之后 score[count]会是多少?
楼主: jerryhey (jerryhey)   2022-01-19 00:46:00
我把count++拿掉sum的下一行加a++平均的地方除a就解决了

Links booklink

Contact Us: admin [ a t ] ucptt.com