谁能看看我处理下面计算的方式是否有问题?即使答案实际上是正确的,我似乎在运行时也得到“你得分 0”。
- (void)countGain{
int gain = 0;
int percentage;
if ([answer objectForKey:@"1"] == [usrAnswer objectForKey:@"1"]) {
gain += 1;
}
percentage = (gain / 10) * 100;
NSString *scored = [[NSString alloc] initWithFormat:@"You scored %d",percentage];
score.text = scored;
rangenans.text = [answer objectForKey:@"1"];
[scored release];
}