Advertisement
BladeMechanics

Midterm Project

Sep 25th, 2017
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 18.75 KB | None | 0 0
  1. #include<time.h>
  2. #include<stdlib.h>
  3. #include<conio.h>
  4. #include<ctype.h>
  5. #include<stdio.h>
  6. #include<Windows.h>
  7.  
  8. /*Your program will allow your brother to play a games where he has to answer series of mathematical questions.
  9. The program will have 3 rounds based on the following level of difficulty with 10 questions per round :
  10. a.Easy – simple mathematical expressions with only one operator  and uses only subtraction and addition(e.g. 4 + 5)
  11. b.Average – simple mathematical expressions with only one operator  and uses only multiplication and division(e.g 5 * 2)
  12. c.Difficult – mathematical expression that uses 2 operator and can be combination of any of the 4 operators(e.g 4 * 5 + 2)
  13. The program should generate 2 random integers between 1 and 10 and randomly picks an operator.
  14. Then it prompts the user for an answer.After the user inputs the answer, your program should tell him whether the answer is too high or too low.
  15. Your program should keep track of how much time he takes for these problems.
  16. In addition, 5 penalty seconds should be added for each incorrect response.
  17. The total time he takes(taking into account the penalty seconds) will be used to determine his score for each question.
  18. The score your brother earns is equal to the total amount of time(in seconds) it took him to finish the problems(including penalty seconds) divided by the number of problems.
  19. The score in seconds then must be converted to an integer number of points in between 0 and 10. In particular, the conversion works as shown in the formula below :
  20. time 1 = score 10. for every + 1 seconds -1 score, if incorrect answer+5 sec. eg. 2 sec 8 score, 9 seconds 1 score. Anything over 10 seconds is automatically 0.
  21. */
  22.  
  23. void gui(int input)
  24. {
  25.     if (input)
  26.     {
  27.         printf("\n\t\t _ _            _\n");
  28.         printf("\t\t%c %c %c ___  _ _ %c %c\n", 179, 179, 179, 179, 179);
  29.         printf("\t\t\\   /<_> %c%c %c %c%c_/\n", 179, 179, 179, 179, 179);
  30.         printf("\t\t %c_%c <___%c`_. %c<_>\n", 179, 179, 179, 179);
  31.         printf("\t\t          <___'   \n");
  32.         printf("\t _ _ _       _  _   ___                 _ \n");
  33.         printf("\t%c %c %c %c ___ %c %c%c %c %c . \\ ___ ._ _  ___ %c %c\n", 179, 179, 179, 179, 179, 179, 179, 179, 179);
  34.         printf("\t%c %c %c %c/ ._>%c %c%c %c %c %c %c/ . \\%c ' %c/ ._>%c_/\n", 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179);
  35.         printf("\t%c__/_/ \\___.%c_%c%c_%c %c___/\\___/%c_%c_%c\\___.<_>\n", 179, 179, 179, 179, 179, 179, 179, 179, 179);
  36.     }
  37.     else
  38.     {
  39.         printf("\n\n\t___  ___      _   _     _    _ _     \n");
  40.         printf("\t%c  \\/  %c     %c %c %c %c   %c %c  %c (_)    \n", 179, 179, 179, 179, 179, 179, 179, 179, 179);
  41.         printf("\t%c .  . %c __ _%c %c_%c %c__ %c %c  %c %c_ ____\n", 179, 179, 179, 179, 179, 179, 179, 179, 179, 179);
  42.         printf("\t%c %c\\/%c %c/ _` %c __%c '_ \\%c %c/\\%c %c %c_  /\n",179,179,179,179,179,179,179,179,179,179,179);
  43.         printf("\t%c %c  %c %c (_%c %c %c_%c %c %c \\  /\\  / %c/ / \n", 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, 179);
  44.         printf("\t\\_%c  %c_/\\__,_%c\\__%c_%c %c_%c\\/  \\/%c_/___%c\n", 179, 179, 179, 179, 179, 179, 179, 179, 179);
  45.     }
  46. }
  47. void main()
  48. {
  49.     int rounds, score=0, operand, operand2;
  50.     int output; //controls output of gui lines in "for"
  51.     float firstNum, secondNum, thirdNum,answer,userAnswer, timer;
  52.     //Variables for roundup operation
  53.     int whole,decimal;
  54.  
  55.     int debug = 3;
  56.     /*
  57.     Level skips will display prompts but bypass the levels.
  58.     Any value of debug will display debug information for the decimal roundup code segment
  59.     1=Skips level 1
  60.     2=Skips level 1,2
  61.     3=All levels skipped
  62.     */
  63.  
  64.     srand(time(NULL));
  65.  
  66.     gui(0);
  67.     printf("\n\n\tThere are three rounds with 10 problems each.\n\n\tYou have 10 seconds to answer each correctly.");
  68.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 220);
  69.     printf("\n\n\tFirst Round:\tAddition/Subtraction");
  70.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 223);
  71.     printf("\n\n\t\tPress any key to begin.");
  72.     _getch();
  73.     printf("\n\n\tGet ready! In...3");
  74.     Sleep(1000);
  75.     printf("...2");
  76.     Sleep(1000);
  77.     printf("...Lets go!");
  78.     Sleep(1000);
  79.  
  80.     //easy mode
  81.     for (rounds = 10; rounds; rounds--)
  82.     {
  83.         if (debug > 1) break; //debug skip
  84.         system("cls");
  85.         gui(0);
  86.         if (rounds>1) printf("\n\n\t\tEquation %d", 10-rounds + 1);
  87.         else printf("\n\n\t\tFinal Equation");
  88.         printf("\n\n\t\tCurrent Score : %d\n", score);
  89.         firstNum = rand() % 10 + 1;
  90.         secondNum = rand() % 10 + 1;
  91.         operand = rand() % 2;
  92.         timer = clock(); //timer begins
  93.         if (operand)
  94.         {
  95.             answer = firstNum + secondNum;
  96.             printf("\n\n\tThe sum of %2.0f + %2.0f is:  ", firstNum,secondNum);
  97.         }//True(1)=Addition
  98.         else
  99.         {
  100.             answer = firstNum - secondNum;
  101.             printf("\n\n\tThe difference of %2.0f - %2.0f is:  ", firstNum, secondNum);
  102.         }//subtraction
  103.         fflush(stdin);
  104.         scanf_s("%f", &userAnswer);
  105.         timer = float((clock()-timer)/1000);
  106.         if      (answer == userAnswer)
  107.                     printf("\n\tYour answer is correct!\n\t");
  108.         else if (answer > userAnswer)
  109.             {  
  110.                     printf("\n\tYour answer is too low! \n\tCorrect Answer: %2.0f\t",answer);
  111.                     timer += 5;
  112.             }  
  113.         else
  114.             {
  115.                     printf("\n\tYour answer is too high! \n\tCorrect Answer: %2.0f\t",answer);
  116.                     timer += 5;
  117.             }
  118.                 /*--------------SCORE EVALUATION--------------*/
  119.         if (timer < 1)      {   score += 10;    printf("Score +10");}
  120.         else if (timer < 2) {   score += 9;     printf("Score +9");}
  121.         else if (timer < 3) {   score += 8;     printf("Score +8");}
  122.         else if (timer < 4) {   score += 7;     printf("Score +7");}
  123.         else if (timer < 5) {   score += 6;     printf("Score +6");}
  124.         else if (timer < 6) {   score += 5;     printf("Score +5");}
  125.         else if (timer < 7) {   score += 4;     printf("Score +4");}
  126.         else if (timer < 8) {   score += 3;     printf("Score +3");}
  127.         else if (timer < 9) {   score += 2;     printf("Score +2");}
  128.         else if (timer < 10){   score += 1;     printf("Score +1");}
  129.         else                {   score += 0;     printf("Score +0");}
  130.                 /*--------------SCORE EVALUATION--------------*/
  131.         if (rounds > 1)
  132.         {
  133.             printf("\n\n\tNext round in 3");
  134.             Sleep(1000);
  135.             printf("...2");
  136.             Sleep(1000);
  137.             printf("...1");
  138.             Sleep(1000);
  139.         }
  140.     }//LoopforEasyMode
  141.  
  142.     //between rounds
  143.     printf("\n\n\tWell done! Next round is coming up");
  144.  
  145.     printf(". ");
  146.     Sleep(1000);
  147.     printf(". ");
  148.     Sleep(1000);
  149.     printf(". ");
  150.  
  151.     system("cls");
  152.     gui(0);
  153.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 220);
  154.     printf("\n\n\tSecond Round:\tDivision/Multiplication");
  155.     printf("\n\n\tFor division, round up answers 2 decimal places.\n\t\t eg. 5.125 > 5.13");
  156.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 223);
  157.     printf("\n\n\t\tPress any key to begin.");
  158.     _getch();
  159.     printf("\n\n\tGet ready! In...3");
  160.     Sleep(1000);
  161.     printf("...2");
  162.     Sleep(1000);
  163.     printf("...Lets go!");
  164.     Sleep(1000);
  165.  
  166.     //average mode
  167.     for (rounds = 10; rounds; rounds--)
  168.     {
  169.         if (debug > 1) break; //debug skip
  170.         system("cls");
  171.         gui(0);
  172.         if (rounds>1) printf("\n\n\t\tEquation %d", 10 - rounds + 1);
  173.         else printf("\n\n\t\tFinal Equation");
  174.         printf("\n\n\t\tCurrent Score : %d\n", score);
  175.         firstNum = rand() % 10 + 1;
  176.         secondNum = rand() % 10 + 1;
  177.         operand = rand() % 2;
  178.         timer = clock(); //timer begins
  179.         if (operand)
  180.         {
  181.             answer = firstNum * secondNum;
  182.             printf("\n\n\tThe product of %2.0f * %2.0f is:  ", firstNum, secondNum);
  183.         }//True(1)=Multiplication
  184.         else
  185.         {
  186.             answer = firstNum / secondNum;
  187.            
  188.                 /*--------------ROUNDUP DECIMAL--------------*/
  189.             whole = answer; //convert to whole answer
  190.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  191.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  192.             else decimal = decimal - decimal % 10 + 10; //roundup
  193.             answer = whole + float(decimal) / 1000; //reassign
  194.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  195.                 /*--------------ROUNDUP DECIMAL--------------*/
  196.        
  197.             printf("\n\n\tThe quotient of %2.0f / %2.0f is:  ", firstNum, secondNum);
  198.         }//Division
  199.         fflush(stdin);
  200.         scanf_s("%f", &userAnswer);
  201.         timer = float((clock() - timer) / 1000);
  202.         if      (answer == userAnswer)
  203.                     printf("\n\tYour answer is correct!\n\t");
  204.         else if (answer > userAnswer)
  205.             {  
  206.                     printf("\n\tYour answer is too low! \n\tCorrect Answer: %2.2f\t",answer);
  207.                     timer += 5;
  208.             }  
  209.         else
  210.             {
  211.                     printf("\n\tYour answer is too high! \n\tCorrect Answer: %2.2f\t",answer);
  212.                     timer += 5;
  213.             }
  214.                 /*--------------SCORE EVALUATION--------------*/
  215.         if (timer < 1)      {   score += 10;    printf("Score +10");}
  216.         else if (timer < 2) {   score += 9;     printf("Score +9");}
  217.         else if (timer < 3) {   score += 8;     printf("Score +8");}
  218.         else if (timer < 4) {   score += 7;     printf("Score +7");}
  219.         else if (timer < 5) {   score += 6;     printf("Score +6");}
  220.         else if (timer < 6) {   score += 5;     printf("Score +5");}
  221.         else if (timer < 7) {   score += 4;     printf("Score +4");}
  222.         else if (timer < 8) {   score += 3;     printf("Score +3");}
  223.         else if (timer < 9) {   score += 2;     printf("Score +2");}
  224.         else if (timer < 10){   score += 1;     printf("Score +1");}
  225.         else                {   score += 0;     printf("Score +0");}
  226.                 /*--------------SCORE EVALUATION--------------*/
  227.         if (rounds > 1)
  228.         {
  229.             printf("\n\n\tNext round in 3");
  230.             Sleep(1000);
  231.             printf("...2");
  232.             Sleep(1000);
  233.             printf("...1");
  234.             Sleep(1000);
  235.         }
  236.     }//Average Mode
  237.  
  238.     printf("\n\n\tWell done! Next round is coming up");
  239.  
  240.     printf(". ");
  241.     Sleep(1000);
  242.     printf(". ");
  243.     Sleep(1000);
  244.     printf(". ");
  245.     system("cls");
  246.  
  247.     gui(0);
  248.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 220);
  249.     printf("\n\n\tFinal Round:\tAll Operators, 3 numbers");
  250.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 223);
  251.     printf("\n\n\t\tPress any key to begin.");
  252.     _getch();
  253.     printf("\n\n\tGet ready! In...3");
  254.     Sleep(1000);
  255.     printf("...2");
  256.     Sleep(1000);
  257.     printf("...Lets go!");
  258.     Sleep(1000);
  259.  
  260.     //Difficult
  261.     for (rounds = 10; rounds; rounds--)
  262.     {
  263.         if (debug > 2) break; //debug skip
  264.         system("cls");
  265.         gui(0);
  266.         if (rounds>1) printf("\n\n\t\tEquation %d", 10 - rounds + 1);
  267.         else printf("\n\n\t\tFinal Equation");
  268.         printf("\n\n\t\tCurrent Score : %d\n", score);
  269.         firstNum = rand() % 10 + 1;
  270.         secondNum = rand() % 10 + 1;
  271.         thirdNum = rand() % 10 + 1;
  272.         operand = rand() % 4;
  273.         operand2 = rand() % 4;
  274.         timer = clock(); //timer begins
  275.         /*------------------------------*/
  276.         // 0 - MULTIPLY
  277.         // 1 - DIVIDE
  278.         // 2 - ADD
  279.         // 3 - SUBRTRACT
  280.         if (operand == 0 && operand2 == 0)
  281.         {
  282.             answer = firstNum * secondNum * thirdNum;
  283.             printf("\n\n\tThe value of %.2f * %.2f * %.2f is:  ", firstNum, secondNum, thirdNum);
  284.         }
  285.         else if (operand == 0 && operand2 == 1)
  286.         {
  287.             answer = firstNum * secondNum / thirdNum;
  288.            
  289.                 /*--------------ROUNDUP DECIMAL--------------*/
  290.             whole = answer; //convert to whole answer
  291.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  292.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  293.             else decimal = decimal - decimal % 10 + 10; //roundup
  294.             answer = whole + float(decimal) / 1000; //reassign
  295.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  296.                 /*--------------ROUNDUP DECIMAL--------------*/
  297.  
  298.             printf("\n\n\tThe value of %.0f * %.0f / %.0f is:  ", firstNum, secondNum, thirdNum);
  299.         }
  300.         else if (operand == 0 && operand2 == 2)
  301.         {
  302.             answer = firstNum * secondNum + thirdNum;
  303.             printf("\n\n\tThe value of %.0f * %.0f + %.0f is:  ", firstNum, secondNum, thirdNum);
  304.         }
  305.         else if (operand == 0 && operand2 == 3)
  306.         {
  307.             answer = firstNum * secondNum - thirdNum;
  308.             printf("\n\n\tThe value of %.0f * %.0f - %.0f is:  ", firstNum, secondNum, thirdNum);
  309.         }
  310.         else if (operand == 1 && operand2 == 0)
  311.         {
  312.             answer = firstNum / secondNum * thirdNum;
  313.            
  314.                 /*--------------ROUNDUP DECIMAL--------------*/
  315.             whole = answer; //convert to whole answer
  316.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  317.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  318.             else decimal = decimal - decimal % 10 + 10; //roundup
  319.             answer = whole + float(decimal) / 1000; //reassign
  320.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  321.                 /*--------------ROUNDUP DECIMAL--------------*/
  322.  
  323.             printf("\n\n\tThe value of %.0f / %.0f * %.0f is:  ", firstNum, secondNum, thirdNum);
  324.         }
  325.         else if (operand == 1 && operand2 == 1)
  326.         {
  327.             answer = firstNum / secondNum / thirdNum;
  328.            
  329.                 /*--------------ROUNDUP DECIMAL--------------*/
  330.             whole = answer; //convert to whole answer
  331.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  332.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  333.             else decimal = decimal - decimal % 10 + 10; //roundup
  334.             answer = whole + float(decimal) / 1000; //reassign
  335.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  336.                 /*--------------ROUNDUP DECIMAL--------------*/
  337.  
  338.             printf("\n\n\tThe value of %.0f / %.0f / %.0f is:  ", firstNum, secondNum, thirdNum);
  339.         }
  340.         else if (operand == 1 && operand2 == 2)
  341.         {
  342.             answer = firstNum / secondNum + thirdNum;
  343.  
  344.                 /*--------------ROUNDUP DECIMAL--------------*/
  345.             whole = answer; //convert to whole answer
  346.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  347.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  348.             else decimal = decimal - decimal % 10 + 10; //roundup
  349.             answer = whole + float(decimal) / 1000; //reassign
  350.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  351.                 /*--------------ROUNDUP DECIMAL--------------*/
  352.  
  353.             printf("\n\n\tThe value of %.0f / %.0f + %.0f is:  ", firstNum, secondNum, thirdNum);
  354.         }
  355.         else if (operand == 1 && operand2 == 3)
  356.         {
  357.             answer = firstNum / secondNum - thirdNum;
  358.            
  359.                 /*--------------ROUNDUP DECIMAL--------------*/
  360.             whole = answer; //convert to whole answer
  361.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  362.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  363.             else decimal = decimal - decimal % 10 + 10; //roundup
  364.             answer = whole + float(decimal) / 1000; //reassign
  365.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  366.                 /*--------------ROUNDUP DECIMAL--------------*/
  367.  
  368.             printf("\n\n\tThe value of %.0f / %.0f - %.0f is:  ", firstNum, secondNum, thirdNum);
  369.         }
  370.         else if (operand == 2 && operand2 == 0)
  371.         {
  372.             answer = firstNum + secondNum * thirdNum;
  373.             printf("\n\n\tThe value of %.0f + %.0f * %.0f is:  ", firstNum, secondNum, thirdNum);
  374.         }
  375.         else if (operand == 2 && operand2 == 1)
  376.         {
  377.             answer = firstNum + secondNum / thirdNum;
  378.  
  379.                 /*--------------ROUNDUP DECIMAL--------------*/
  380.             whole = answer; //convert to whole answer
  381.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  382.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  383.             else decimal = decimal - decimal % 10 + 10; //roundup
  384.             answer = whole + float(decimal) / 1000; //reassign
  385.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  386.                 /*--------------ROUNDUP DECIMAL--------------*/
  387.  
  388.             printf("\n\n\tThe value of %.0f + %.0f / %.0f is:  ", firstNum, secondNum, thirdNum);
  389.         }
  390.         else if (operand == 2 && operand2 == 2)
  391.         {
  392.             answer = firstNum + secondNum + thirdNum;
  393.             printf("\n\n\tThe value of %.0f + %.0f + %.0f is:  ", firstNum, secondNum, thirdNum);
  394.         }
  395.         else if (operand == 2 && operand2 == 3)
  396.         {
  397.             answer = firstNum + secondNum - thirdNum;
  398.             printf("\n\n\tThe value of %.0f + %.0f - %.0f is:  ", firstNum, secondNum, thirdNum);
  399.         }
  400.         else if (operand == 3 && operand2 == 0)
  401.         {
  402.             answer = firstNum - secondNum * thirdNum;
  403.             printf("\n\n\tThe value of %.0f - %.0f * %.0f is:  ", firstNum, secondNum, thirdNum);
  404.         }
  405.         else if (operand == 3 && operand2 == 1)
  406.         {
  407.             answer = firstNum - secondNum / thirdNum;
  408.  
  409.                 /*--------------ROUNDUP DECIMAL--------------*/
  410.             whole = answer; //convert to whole answer
  411.             decimal = (float(answer) - whole) * 1000; //remove whole answer and turn decimal to whole answer
  412.             if ((decimal % 10)<5) decimal -= decimal % 10; //rounddown
  413.             else decimal = decimal - decimal % 10 + 10; //roundup
  414.             answer = whole + float(decimal) / 1000; //reassign
  415.             if (debug) printf("%f answer, %d decimal, whole %d", answer, decimal, whole); /*DEBUG FUNCTION*/
  416.                 /*--------------ROUNDUP DECIMAL--------------*/
  417.  
  418.             printf("\n\n\tThe value of %.0f - %.0f / %.0f is:  ", firstNum, secondNum, thirdNum);
  419.         }
  420.         else if (operand == 3 && operand2 == 2)
  421.         {
  422.             answer = firstNum - secondNum + thirdNum;
  423.             printf("\n\n\tThe value of %.0f - %.0f + %.0f is:  ", firstNum, secondNum, thirdNum);
  424.         }
  425.         else if (operand == 3 && operand2 == 3) //I can put else implying (n1-n2-n3) operations.
  426.         {
  427.             answer = firstNum - secondNum - thirdNum;
  428.             printf("\n\n\tThe value of %.0f - %.0f - %.0f is:  ", firstNum, secondNum, thirdNum);
  429.         }
  430.         /*------------------------------*/
  431.         fflush(stdin);
  432.         scanf_s("%f", &userAnswer);
  433.         timer = float((clock() - timer) / 1000);
  434.         if (answer == userAnswer)
  435.             printf("\n\tYour answer is correct!\n\t");
  436.         else if (answer > userAnswer)
  437.         {
  438.             printf("\n\tYour answer is too low! \n\tCorrect Answer: %.2f\t", answer);
  439.             timer += 5;
  440.         }
  441.         else
  442.         {
  443.             printf("\n\tYour answer is too high! \n\tCorrect Answer: %.2f\t", answer);
  444.             timer += 5;
  445.         }
  446.                 /*--------------SCORE EVALUATION--------------*/
  447.         if (timer < 1)      {   score += 10;    printf(" Score +10");}
  448.         else if (timer < 2) {   score += 9;     printf(" Score +9");}
  449.         else if (timer < 3) {   score += 8;     printf(" Score +8");}
  450.         else if (timer < 4) {   score += 7;     printf(" Score +7");}
  451.         else if (timer < 5) {   score += 6;     printf(" Score +6");}
  452.         else if (timer < 6) {   score += 5;     printf(" Score +5");}
  453.         else if (timer < 7) {   score += 4;     printf(" Score +4");}
  454.         else if (timer < 8) {   score += 3;     printf(" Score +3");}
  455.         else if (timer < 9) {   score += 2;     printf(" Score +2");}
  456.         else if (timer < 10){   score += 1;     printf(" Score +1");}
  457.         else                {   score += 0;     printf(" Score +0");}
  458.                 /*--------------SCORE EVALUATION--------------*/
  459.         if (rounds > 1)
  460.         {
  461.             printf("\n\n\tNext round in 3");
  462.             Sleep(1000);
  463.             printf("...2");
  464.             Sleep(1000);
  465.             printf("...1");
  466.             Sleep(1000);
  467.         }
  468.     }//Hard Mode
  469.     Sleep(1000);
  470.     system("cls");
  471.     gui(1);
  472.     printf("\n\n\tYou completed the game!");
  473.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 220);
  474.     printf("\n\n\tYour final score is %d", score);
  475.     printf("\n\n\t"); for (output = 48; output; output--) printf("%c", 223);
  476.     printf("\n\n\tThanks for playing! Press any key to exit.");
  477.     _getch();
  478. }//program ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement