I have written a program in C language. The program is designed for primary school students in Grades 1-2. Two integers are randomly selected, the numbers are either added or subtracted to form an equation, and the students are asked to solve the equation.
Criteria yet to be fulfilled:
At the end of the test, a message should appear prompting the player to choose "Show results", by entering the letter "S", "Play another round", by entering the letter "P", and "Quit", by entering the letter "Q". If the player entered "S" after one round of the game, output the player's score (marks/100). If the player chooses "Show results" after multiple rounds of the game, the output should include the player's highest score/%, lowest score/%, and the average score/% of all games played. If the player enters "Q", the program ends.
I have no idea how to output scores for the overall games played, so here's my not-so-bright attempt:
What I have tried:
while (unsure)
{
unsure = false;
puts("Show results(S)");
puts("Play another round(P)");
puts("Quit(Q)");
char choice;
scanf("%c", &choice);
if (choice == 'Q')
done = true;
else if (choice == 'S') {
if (rounds == 1)
printf("Final score: %d/100\n", g);
else
{
puts("Whoops! Looks like highest/lowest have not been adjusted!");
printf("Highest score: %d/100\n", highest);
printf("Lowest score: %d/100\n", lowest);
}
getchar();
}
else if (choice == 'P')
{
} else
{
puts("Invalid input!");
unsure = true;
}
}
if (done) break;
}