Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (rounds = 10; rounds; rounds--)
- {
- break; //debug skip
- system("cls");
- gui(0);
- if (rounds>1) printf("\n\n\t\tEquation %d", 10-rounds + 1);
- else printf("\n\n\t\tFinal Equation");
- printf("\n\n\t\tCurrent Score : %d\n", score);
- firstNum = rand() % 10 + 1;
- secondNum = rand() % 10 + 1;
- operand = rand() % 2;
- timer = clock(); //timer begins
- if (operand)
- {
- answer = firstNum + secondNum;
- printf("\n\n\tThe sum of %2.0f + %2.0f is: ", firstNum,secondNum);
- }//True(1)=Addition
- else
- {
- answer = firstNum - secondNum;
- printf("\n\n\tThe difference of %2.0f - %2.0f is: ", firstNum, secondNum);
- }//subtraction
- fflush(stdin);
- scanf_s("%f", &userAnswer);
- timer = float((clock()-timer)/1000);
- if (answer == userAnswer)
- printf("\n\tYour answer is correct!\n\t");
- else if (answer > userAnswer)
- {
- printf("\n\tYour answer is too low! \n\tCorrect Answer: %2.0f\t",answer);
- timer += 5;
- }
- else
- {
- printf("\n\tYour answer is too high! \n\tCorrect Answer: %2.0f\t",answer);
- timer += 5;
- }
- /*--------------SCORE EVALUATION--------------*/
- if (timer < 1) { score += 10; printf("Score +10");}
- else if (timer < 2) { score += 9; printf("Score +9");}
- else if (timer < 3) { score += 8; printf("Score +8");}
- else if (timer < 4) { score += 7; printf("Score +7");}
- else if (timer < 5) { score += 6; printf("Score +6");}
- else if (timer < 6) { score += 5; printf("Score +5");}
- else if (timer < 7) { score += 4; printf("Score +4");}
- else if (timer < 8) { score += 3; printf("Score +3");}
- else if (timer < 9) { score += 2; printf("Score +2");}
- else if (timer < 10){ score += 1; printf("Score +1");}
- else { score += 0; printf("Score +0");}
- /*--------------SCORE EVALUATION--------------*/
- if (rounds > 1)
- {
- printf("\n\n\tNext round in 3");
- Sleep(1000);
- printf("...2");
- Sleep(1000);
- printf("...1");
- Sleep(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement