开发者

How to calculate?

开发者 https://www.devze.com 2023-01-18 17:29 出处:网络
I just tried to calculate something. All my input is int. int aveScore = (startScore/((([p1.arrayThrow count]-1)) + winPane.throws));

I just tried to calculate something. All my input is int.

int aveScore = (startScore/((([p1.arrayThrow count]-1)) + winPane.throws));  

The result is (for startscore = 501 and the rest = 3 [501/3 = 167]) 100. Even tried float aveScore which results in something l开发者_如何学Pythonike 10359. Also didn't work:

int aveScore = (float) ...  

What is wrong here?


int aveScore = (int)((float)startScore / (([p1.arrayThrow count] - 1) + winPane.throws));

EDIT:

If you want a floating point average score then it would just be:

float aveScore = (float)startScore / (([p1.arrayThrow count] - 1) + winPane.throws);

0

精彩评论

暂无评论...
验证码 换一张
取 消