Hello,
I am trying to write a simple program that asks users yes/no questions and, based on those answers, tells them where they stand on the political spectrum.
I have a variable in my code called "questionnumber." My thought was that every time the user clicked the "nextbutton" in my IB interface, I would increase the "questionnumber" variable by 1 and thus present a new question.
This works for questions 1 and 2. But then it starts skipping every other question. Can someone tell me why? I'm stumped! The code appears below: (My IB interface buttons are keyed for "touch up inside" in case that makes a difference.)
#import "MainView.h"
#import <Foundation/Foundation.h>
@implementation MainView
@synthesize Question;
@synthesize mispar;
int conservative = 0;
int liberal = 0;
int questionnumber = 0;
- (IBAction)agreebutton: (id) sender {
++liberal;
}
- (IBAction)disagreebutton

id) sender {
++conservative;
}
- (IBAction)nextbutton

id) sender {
++questionnumber;
switch (questionnumber) {
case 1:
Question.text = @"Congress should pass a law that would ban Americans from earning more than one hundred million dollars in any given year.";
break;
case 2:
Question.text = @"It is not fair to admit people to a university or employ them on the basis of merit alone. Factors such as race, gender, class, and sexual orientation must also be considered.";
break;
case 3:
Question.text = @"There are two Americas - one for the rich and one for the poor.";
break;
case 4:
Question.text = @"Top quality health care should be free for all.";
break;
default:
break;
}
}
@end