80 lines
1.6 KiB
C++
80 lines
1.6 KiB
C++
|
get userID();
|
||
|
get userAge();
|
||
|
displayUserInfo();
|
||
|
getUserInputGameMode();
|
||
|
1.timeMode()
|
||
|
2.quizMode()
|
||
|
3.practiceMode()
|
||
|
4.calculatorMode()
|
||
|
5.highScore()
|
||
|
Case1:
|
||
|
displayTimeMode();
|
||
|
userInputTimer();
|
||
|
set time=userInputTimer();
|
||
|
if (time >0)
|
||
|
{
|
||
|
A = randomA();
|
||
|
B = randomB();
|
||
|
answerC = A+B;
|
||
|
displayA();
|
||
|
displayB();
|
||
|
D= randomD();
|
||
|
if D=== C then randomD();
|
||
|
else displayD();
|
||
|
If user click on answerC then add ++ correctCounter;
|
||
|
else set A=randomA(); set B=randomA();
|
||
|
}
|
||
|
</font></font></font><font color="#000000"> else save correctCounter to log;
|
||
|
print “ Retry?” or “ exit”
|
||
|
if user click retry, get userInputTimer();
|
||
|
if user click exit, return to main menu;
|
||
|
case2:
|
||
|
question=setNumberOfQuestion();
|
||
|
setArrayASize = question;
|
||
|
setArrayBSize= question;
|
||
|
setArrayCsize= question;
|
||
|
for( i =0; i< question;i++)
|
||
|
{
|
||
|
arrayA[i]= random();
|
||
|
arrayB[i] = random();
|
||
|
arrayC[i]=arrayA[i]+arrayB[i]
|
||
|
|
||
|
}
|
||
|
for(i=0;i<question;i++)
|
||
|
{
|
||
|
print arrayA[i] “ + “ print arrayB[i] “ = “
|
||
|
arrayD[i]= userInput();
|
||
|
if (arrayC[i]= arrayD[i] )
|
||
|
correct++;
|
||
|
else
|
||
|
wrong++;
|
||
|
}
|
||
|
|
||
|
display correct and wrong to screen;
|
||
|
for(i=0;i<question;i++)
|
||
|
{
|
||
|
display arrayA[i]“+” ArrayB[i] “= “ arrayC[i] “your Answer” arrayD[i];
|
||
|
|
||
|
}
|
||
|
ask user to continue quiz or exit to main screen
|
||
|
case3:
|
||
|
|
||
|
if (continue = yes)
|
||
|
{
|
||
|
A= randomNumber();
|
||
|
B= randomNumber();
|
||
|
C= A+B;
|
||
|
display A “+ “ B “=“ then get userInput();
|
||
|
compare to C to userInput();
|
||
|
get userInputContinue();
|
||
|
}
|
||
|
else
|
||
|
exit to main menu
|
||
|
|
||
|
case4:
|
||
|
display calculator
|
||
|
|
||
|
case5:
|
||
|
DisplayScore();
|
||
|
|