I am making a maths program and i need to show the longest streak of correct answers and also the longest streak of the incorrect answers.
how can i do this? I can only think of something like
1 2 3 4 5
int correct=0, incorrect = 0;
if (answer==result)
correct++;
else
incorrect++;
the problem with that though it will only show the amount of answers that are correct and incorrect but will not actually find the longest streak.
What you have is a good start. Now make correct be the number of correct answers since the last incorrect answer and vice versa. Add variables to store the longest streak of correct and incorrect answers, and update them when needed.
I read it as "else if"... and somehow managed to get it as if answer != result, then currentstreak = 0 and after that - let's see if it's bigger than longerstreak!