This is so weird... I would think this would work... but it just doesnt....
Anybody understand why?
Do you see the part at the end were it says:
why doesnt that work... Im trying to get varRight and varWrong to get subtracted by one... Why wont it work?
Anybody understand why?
Code:
//
// AppController.m
// Right N' Wrong
//
// Created by Daniel Kindler on 4/4/09.
// Copyright 2009 Stdio.H. All rights reserved.
//
#import "AppController.h"
@implementation AppController
- (void) updateScore {
double percentScore = 100.0 * varRight / (varWrong + varRight);
[percentCorrect setStringValue:[NSString stringWithFormat:@"%.1f%%", percentScore]];
}
- (void)correctAns {
[numberRight setStringValue:[NSString stringWithFormat:@"%i Correct", varRight]];
}
-(void)wrongAns {
[numberWrong setStringValue:[NSString stringWithFormat:@"%i Incorrect", varWrong]];
}
- (IBAction)reset:(id)sender; {
varRight = 0;
varWrong = 0;
[self wrongAns];
[self correctAns];
[percentCorrect setStringValue:[NSString stringWithFormat:@"0.0%%"]];
}
- (IBAction)right:(id)sender; {
varRight++;
[self correctAns];
[self updateScore];
}
- (IBAction)wrong:(id)sender; {
varWrong++;
[self wrongAns];
[self updateScore];
}
- (IBAction)subOneRight:(id)sender {
varRight - 1;
[self correctAns];
[self updateScore];
}
- (IBAction)subOneWrong:(id)sender {
varWrong - 1;
[self wrongAns];
[self updateScore];
}
@end
Do you see the part at the end were it says:
Code:
- (IBAction)subOneRight:(id)sender {
varRight - 1;
[self correctAns];
[self updateScore];
}
- (IBAction)subOneWrong:(id)sender {
varWrong - 1;
[self wrongAns];
[self updateScore];
}
why doesnt that work... Im trying to get varRight and varWrong to get subtracted by one... Why wont it work?