So basically it involves sodding scanf().
int NumericalAnswer;
int score = 0;
main()
{
printf("Question 1: What's 4 x 3?\n");
scanf("%d\n", &NumericalAnswer);
if (NumericalAnswer == 12){
printf("You got it right!");
score += 1;
}
}
Output
Question 1: What's 4 x 3?
12
9
You got it right!
As you may have worked out, it's making me type two answers before it'll progress. I've added a printf() at the end to check the value of NumericalAnswer, and it's of the first answer I enter. So my program will still produce the correct output eventually, I just don't want to have to enter the number twice.
Any help would be greatly appreciated.
Ed