How to calculate?
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);
精彩评论