Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 18.54 KB | None | 0 0
  1. /*
  2. YOU ARE DOING IT FUCKING WRONG.
  3.  
  4. - S.
  5. */
  6.  
  7.  
  8. #include <stdio.h>
  9. #include<8051.h>
  10. #include <stdlib.h>
  11. char getchar();
  12. void putchar(char c);
  13. unsigned char delay();
  14.  
  15. void main()
  16. {
  17.    
  18.     int x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q,p,count,end,score,questions;
  19.     h=1;
  20.     i=0;
  21.     j=3;
  22.     k=7;
  23.     l=4;
  24.     count=0;
  25.     score=0;
  26.     questions=0;
  27.  
  28.    
  29.     printf("#WELCOME TO THE MATHS GAME!#\n");
  30.  
  31.     printf("#WHERE YOUR MATHS KNOWLEDGE IS TESTED!#\n");
  32.  
  33.     printf("INFO:YOU HAVE 'THREE' LIVE LINES!\n");
  34.  
  35.     printf("INFO:GET THREE WRONG AND ITS GAMEOVER!!\n");
  36.  
  37.     printf("TRUE=1, FALSE=0\n");
  38.  
  39.     printf("Is 5>4 ?\n");
  40.     questions=questions+1;
  41.     x=getchar();
  42.     if (x==h)
  43.         {
  44.         printf("CORRECT!\n");
  45.     score=score+1;
  46.     }
  47.             else if (x==i)
  48.             {
  49.             printf("WRONG!\n");
  50.         count=count+1;
  51.             }
  52.                 else if(x>1)
  53.  {
  54.                     printf("Is 5>4 ?\n");
  55.                     printf("True=1!, False=0!\n");
  56.                     x=getchar();
  57.             if (x==h)
  58.                 {
  59.                 printf("CORRECT!\n");
  60.             score=score+1;
  61.             }
  62.                     else if (x==i)
  63.                     {
  64.                     printf("WRONG!\n");
  65.                 count=count+1;
  66.                     }
  67. }
  68.                 if (count<3)
  69.                             {
  70.                         printf("Is 2x3=6\n");
  71.                     questions=questions+1;
  72.                     y=getchar();
  73.                     if (y==h)
  74.                         {
  75.                             printf("CORRECT!\n");
  76.                     score=score+1;
  77.                     }
  78.                         else if (y==i)
  79.                             {
  80.                             printf("WRONG!\n");
  81.                         count=count+1;
  82.                             }
  83.                                 else if(y>1)
  84.                                 {
  85.                                     printf("Is 2x3=6\n");
  86.                                     printf("True=1!, False=0!\n");
  87.                                     y=getchar();
  88.                             if (y==h)
  89.                                 {
  90.                                     printf("CORRECT!\n");
  91.                             score=score+1;
  92.                             }
  93.                                 else if (y==i)
  94.                                     {
  95.                                     printf("WRONG!\n");
  96.                                 count=count+1;
  97.                                     }
  98.                                     }
  99.                                 }
  100.                                         if (count<3)
  101.                             {
  102.                         printf("How many sides does a heptagon have?\n");
  103.                     printf("A=3....B=4....C=7\n");
  104.                     questions=questions+1;
  105.                     n=getchar();
  106.                     if (n==k)
  107.                         {
  108.                             printf("CORRECT!\n");
  109.                     score=score+1;
  110.                     }
  111.                         else if (n==h)
  112.                             {
  113.                             printf("WRONG!\n");
  114.                         count=count+1;
  115.                             }
  116.                             else if (n==l)
  117.                             {
  118.                             printf("WRONG!\n");
  119.                         count=count+1;
  120.                             }
  121.                                 else if((n!=3)&&(n!=4))
  122.                                 {
  123.                             printf("Number outside of range!!!!!\n");
  124.                                     printf("How many sides does a heptagon have?\n");
  125.                             printf("A=3....B=4....C=7\n");
  126.                             questions=questions+1;
  127.                                 n=getchar();
  128.                                 if (n==k)
  129.                                     {
  130.                                         printf("CORRECT!\n");
  131.                                 score=score+1;
  132.                                 }
  133.                                     else if (n==h)
  134.                                         {
  135.                                         printf("WRONG!\n");
  136.                                     count=count+1;
  137.                                         }
  138.                                         else if (n==l)
  139.                                             {
  140.                                             printf("WRONG!\n");
  141.                                         count=count+1;
  142.                                             }
  143.                                             else if(n!=7)
  144.                                                 {
  145.                                             printf("Number outside of range!!!!!\n");
  146.                                                     printf("How many sides does a heptagon have?\n");
  147.                                             printf("A=3....B=4....C=7\n");
  148.                                             questions=questions+1;
  149.                                             n=getchar();
  150.                                             if (n==k)
  151.                                                 {
  152.                                                     printf("CORRECT!\n");
  153.                                             score=score+1;
  154.                                             }
  155.                                                 else if (n==h)
  156.                                                     {
  157.                                                     printf("WRONG!\n");
  158.                                                 count=count+1;
  159.                                                     }
  160.                                                 else if (n==l)
  161.                                                     {
  162.                                                     printf("WRONG!\n");
  163.                                                 count=count+1;
  164.                                                     }
  165.                             }  
  166.                                 if (count<3)
  167.                                             {
  168.                                 printf("Is 1+1=2\n");
  169.                                 questions=questions+1;
  170.                                         z=getchar();
  171.                                         if (z==h)
  172.                                         {
  173.                                         printf("CORRECT!\n");
  174.                                 score=score+1;
  175.                                     }
  176.                                         else if (z==i)
  177.                                         {
  178.                                         printf("WRONG!\n");
  179.                                     count=count+1;
  180.                                         }
  181.                                             else if(z>1)
  182.                                             {
  183.                                                 printf("Is 1+1=2\n");
  184.                                                 printf("True=1!, False=0!\n");
  185.                                                 z=getchar();
  186.                                         if (z==h)
  187.                                                 {
  188.                                                 printf("CORRECT!\n");
  189.                                         score=score+1;
  190.                                             }
  191.                                                 else if (z==i)
  192.                                                 {
  193.                                                 printf("WRONG!\n");
  194.                                             count=count+1;
  195.                                                 }
  196.                                             }
  197.                                             if (count<3)
  198.                                                         {
  199.                                                     printf("Is 1+4=7\n");
  200.                                             questions=questions+1;
  201.                                                     a=getchar();
  202.                                                     if (a==h)
  203.                                                     {
  204.                                                         printf("WRONG!\n");
  205.                                             count=count+1;
  206.                                             }
  207.                                                 else if (a==i)
  208.                                                     {
  209.                                                     printf("CORRECT!\n");
  210.                                                 score=score+1;
  211.                                                     }
  212.                                                         else if(a>1)
  213.                                                         {
  214.                                                             printf("Is 1+4=7\n");
  215.                                                             printf("True=1!, False=0!\n");
  216.                                                             a=getchar();
  217.                                                     if (a==h)
  218.                                                             {
  219.                                                                 printf("WRONG!\n");
  220.                                                     count=count+1;
  221.                                                     }
  222.                                                         else if (a==i)
  223.                                                             {
  224.                                                             printf("CORRECT!\n");
  225.                                                         score=score+1;
  226.                                                             }
  227.                                                         }
  228.                                                         if (count<3)
  229.                                                                     {
  230.                                                                     printf("Is 3-2=10\n");
  231.                                                         questions=questions+1;
  232.                                                                     b=getchar();
  233.                                                                     if (b==h)
  234.                                                                     {
  235.                                                                     printf("WRONG!\n");
  236.                                                         count=count+1;
  237.                                                             }
  238.                                                             else if (b==i)
  239.                                                                 {
  240.                                                                 printf("CORRECT!\n");
  241.                                                             score=score+1;
  242.                                                                 }
  243.                                                                     else if(b>1)
  244.                                                                     {
  245.                                                                         printf("Is 3-2=10\n");
  246.                                                                 printf("True=1!, False=0!\n");
  247.                                                                         b=getchar();
  248.                                                                 if (b==h)
  249.                                                                             {
  250.                                                                             printf("WRONG!\n");
  251.                                                                 count=count+1;
  252.                                                                     }
  253.                                                                     else if (b==i)
  254.                                                                         {
  255.                                                                         printf("CORRECT!\n");
  256.                                                                     score=score+1;
  257.                                                                         }
  258.                                                                     }
  259.                                                                     if (count<3)
  260.                                                                                 {
  261.                                                                                 printf("Is 64^(1/2)=8\n");
  262.                                                                     questions=questions+1;
  263.                                                                                 c=getchar();
  264.                                                                                 if (c==h)
  265.                                                                                 {
  266.                                                                                     printf("CORRECT!\n");
  267.                                                                     score=score+1;
  268.                                                                     }
  269.                                                                         else if (c==i)
  270.                                                                             {
  271.                                                                             printf("WRONG!\n");
  272.                                                                         count=count+1;
  273.                                                                             }
  274.                                                                                 else if(c>1)
  275.                                                                                 {
  276.                                                                                     printf("Is 64^(1/2)=8\n");
  277.                                                                                     printf("True=1!, False=0!\n");
  278.                                                                                     c=getchar();
  279.                                                                             if (c==h)
  280.                                                                                         {
  281.                                                                                             printf("CORRECT!\n");
  282.                                                                             score=score+1;
  283.                                                                             }
  284.                                                                                 else if (c==i)
  285.                                                                                     {
  286.                                                                                     printf("WRONG!\n");
  287.                                                                                 count=count+1;
  288.                                                                                     }
  289.                                                                                 }
  290.                                                                                                 if (count<3)
  291.                             {
  292.                         printf("How many sides does a triangle have?\n");
  293.                     printf("A=3....B=1....C=7\n");
  294.                     questions=questions+1;
  295.                     m=getchar();
  296.                     if (m==j)
  297.                         {
  298.                             printf("CORRECT!\n");
  299.                     score=score+1;
  300.                     }
  301.                         else if (m==h)
  302.                             {
  303.                             printf("WRONG!\n");
  304.                         count=count+1;
  305.                             }
  306.                             else if (m==k)
  307.                             {
  308.                             printf("WRONG!\n");
  309.                         count=count+1;
  310.                             }
  311.                                 else if((m!=3)&&(m!=1))
  312.                                 {
  313.                             printf("Number outside of range!!!!!\n");
  314.                                     printf("How many sides does a triangle have?\n");
  315.                             printf("A=3....B=1....C=7\n");
  316.                                     m=getchar();
  317.                             if (m==j)
  318.                                 {
  319.                                     printf("CORRECT!\n");
  320.                             score=score+1;
  321.                             }
  322.                                 else if (m==h)
  323.                                     {
  324.                                     printf("WRONG!\n");
  325.                                 count=count+1;
  326.                                     }
  327.                                     else if (m==k)
  328.                                         {
  329.                                         printf("WRONG!\n");
  330.                                     count=count+1;
  331.                                         }
  332.                             else if(m!=7)
  333.                                 {
  334.                             printf("Number outside of range!!!!!\n");
  335.                                     printf("How many sides does a triangle have?\n");
  336.                             printf("A=3....B=1....C=7\n");
  337.                                     m=getchar();
  338.                             if (m==j)
  339.                                 {
  340.                                     printf("CORRECT!\n");
  341.                             score=score+1;
  342.                             }
  343.                                 else if (m==h)
  344.                                     {
  345.                                     printf("WRONG!\n");
  346.                                 count=count+1;
  347.                                     }
  348.                                     else if (m==k)
  349.                                         {
  350.                                         printf("WRONG!\n");
  351.                                     count=count+1;
  352.                                         }
  353.                             }
  354.                                                                                 if (count<3)
  355.                                                                                             {
  356.                                                                                                 printf("Is 4/6=2/3\n");
  357.                                                                                 questions=questions+1;
  358.                                                                                                 d=getchar();
  359.                                                                                                 if (d==h)
  360.                                                                                                 {
  361.                                                                                                 printf("CORRECT!\n");
  362.                                                                                 score=score+1;
  363.                                                                                     }
  364.                                                                                     else if (d==i)
  365.                                                                                             {
  366.                                                                                             printf("WRONG!\n");
  367.                                                                                         count=count+1;
  368.                                                                                             }
  369.                                                                                             else if(d>1)
  370.                                                                                                 {
  371.                                                                                                 printf("Is 4/6 = 2/3?\n");
  372.                                                                                                     printf("True=1!, False=0!\n");
  373.                                                                                                     d=getchar();
  374.                                                                                             if (d==h)
  375.                                                                                                             {
  376.                                                                                                             printf("CORRECT!\n");
  377.                                                                                             score=score+1;
  378.                                                                                                 }
  379.                                                                                                 else if (d==i)
  380.                                                                                                     {
  381.                                                                                                     printf("WRONG!\n");
  382.                                                                                                 count=count+1;
  383.                                                                                                     }
  384.                                                                                                             if (count<3)
  385.                             {
  386.                         printf("How many sides does a square have?\n");
  387.                     printf("A=3....B=4....C=7\n");
  388.                     questions=questions+1;
  389.                     o=getchar();
  390.                     if (o==l)
  391.                         {
  392.                             printf("CORRECT!\n");
  393.                     score=score+1;
  394.                     }
  395.                         else if (o==k)
  396.                             {
  397.                             printf("WRONG!\n");
  398.                         count=count+1;
  399.                             }
  400.                             else if (o==j)
  401.                                 {
  402.                                 printf("WRONG!\n");
  403.                             count=count+1;
  404.                                 }
  405.                                     else if((o!=3)&&(o!=4))
  406.                                     {
  407.                                 printf("Number outside of range!!!!!\n");
  408.                                         printf("How many sides does a square have?\n");
  409.                                 printf("A=3....B=4....C=7\n");
  410.                                 questions=questions+1;
  411.                                 o=getchar();
  412.                                 if (o==l)
  413.                                     {
  414.                                         printf("CORRECT!\n");
  415.                                 score=score+1;
  416.                                 }
  417.                                     else if (o==k)
  418.                                         {
  419.                                         printf("WRONG!\n");
  420.                                     count=count+1;
  421.                                         }
  422.                                         else if (o==j)
  423.                                             {
  424.                                             printf("WRONG!\n");
  425.                                         count=count+1;
  426.                                             }
  427.                                             else if(o!=7)
  428.                                                 {
  429.                                             printf("Number outside of range!!!!!\n");
  430.                                                     printf("How many sides does a square have?\n");
  431.                                             printf("A=3....B=4....C=7\n");
  432.                                             questions=questions+1;
  433.                                             n=getchar();
  434.                                             if (o==l)
  435.                                                 {
  436.                                                     printf("CORRECT!\n");
  437.                                             score=score+1;
  438.                                             }
  439.                                                 else if (o==k)
  440.                                                     {
  441.                                                     printf("WRONG!\n");
  442.                                                 count=count+1;
  443.                                                     }
  444.                                                     else if (o==j)
  445.                                                         {
  446.                                                         printf("WRONG!\n");
  447.                                                     count=count+1;
  448.                                                         }
  449.                             }  
  450.                                                                                                 }
  451.                                                                                                 if (count<3)
  452.                                                                                                             {
  453.                                                                                                                 printf("Is 7>9\n");
  454.                                                                                                 questions=questions+1;
  455.                                                                                                                 e=getchar();
  456.                                                                                                                 if (e==h)
  457.                                                                                                                 {
  458.                                                                                                                 printf("WRONG!\n");
  459.  
  460.                                                                                                 count=count+1;
  461.                                                                                                 }
  462.                                                                                                     else if (e==i)
  463.                                                                                                         {
  464.                                                                                                         printf("CORRECT!\n");
  465.                                                                                                     score=score+1;
  466.                                                                                                         }
  467.                                                                                                             else if(e>1)
  468.                                                                                                             {
  469.                                                                                                                 printf("Is 7>9\n");
  470.                                                                                                                 printf("True=1!, False=0!\n");
  471.                                                                                                                 e=getchar();
  472.                                                                                                         if (e==h)
  473.                                                                                                                         {
  474.                                                                                                                         printf("WRONG!\n");
  475.                                                                                                         count=count+1;
  476.                                                                                                         }
  477.                                                                                                             else if (e==i)
  478.                                                                                                                 {
  479.                                                                                                                 printf("CORRECT!\n");
  480.                                                                                                             score=score+1;
  481.                                                                                                                 }
  482.                                                                                                             }
  483.                                                                                                             if (count<3)
  484.                                                                                                                         {
  485.                                                                                                                                 printf("Is 5-3=23\n");
  486.                                                                                                             questions=questions+1;
  487.                                                                                                                                 f=getchar();
  488.                                                                                                                                 if (f==h)
  489.                                                                                                                                 {
  490.                                                                                                                                 printf("WRONG!\n");        
  491.                                                                                                             count=count+1;
  492.                                                                                                                 }
  493.                                                                                                                 else if (f==i)
  494.                                                                                                                     {
  495.                                                                                                                     printf("CORRECT!\n");
  496.                                                                                                                 score=score+1;
  497.                                                                                                                     }
  498.                                                                                                                         else if(f>1)
  499.                                                                                                                         {
  500.                                                                                                                             printf("Is 5-3=23\n");
  501.                                                                                                                             printf("True=1!, False=0!\n");
  502.                                                                                                                             f=getchar();
  503.                                                                                                                     if (f==h)
  504.                                                                                                                                         {
  505.                                                                                                                                         printf("WRONG!\n");
  506.                                                                                                                     count=count+1;
  507.                                                                                                                         }
  508.                                                                                                                         else if (f==i)
  509.                                                                                                                             {
  510.                                                                                                                             printf("CORRECT!\n");
  511.                                                                                                                         score=score+1;
  512.                                                                                                                             }
  513.                                                                                                                         }
  514.                                                                                                                         if (count<3)
  515.                                                                                                                                     {
  516.                                                                                                                                             printf("Is 4x5=0\n");
  517.                                                                                                                         questions=questions+1;
  518.                                                                                                                                             g=getchar();
  519.                                                                                                                                             if (g==h)
  520.                                                                                                                                             {
  521.                                                                                                                                                 printf("WRONG!\n");
  522.                                                                                                                         count=count+1;
  523.                                                                                                                                             }
  524.                                                                                                                             else if (g==i)
  525.                                                                                                                                 {
  526.                                                                                                                                 printf("CORRECT!\n");
  527.                                                                                                                             score=score+1;
  528.                                                                                                                             end=1;
  529.                                                                                                                                 }
  530.                                                                                                                                     else if(g>1)
  531.                                                                                                                                     {
  532.                                                                                                                                         printf("Is 4x5=0\n");
  533.                                                                                                                                         printf("True=1!, False=0!\n");
  534.                                                                                                                                         g=getchar();
  535.                                                                                                                                 if (g==h)
  536.                                                                                                                                                     {
  537.                                                                                                                                                         printf("WRONG!\n");
  538.                                                                                                                                 count=count+1;
  539.                                                                                                                                                     }
  540.                                                                                                                                     else if (g==i)
  541.                                                                                                                                         {
  542.                                                                                                                                         printf("CORRECT!\n");
  543.                                                                                                                                     score=score+1;
  544.                                                                                                                                     end=1;
  545.                                                                                                                                         }
  546.                                                                                                                                     }
  547.                                                                                                                                     }
  548.                                                                                                                             }
  549.                                                                                                                         }
  550.                                                                                                                     }
  551.                                                                                                                 }
  552.                                                                                                             }
  553.                                                                                                         }
  554.                                                                                                     }
  555.                                                                                                
  556.  
  557.  
  558.  
  559.  
  560.  
  561. /*unsigned char delay(void)
  562. {
  563.     unsigned char q=0xFF;
  564.     while(q)
  565.     q--;
  566. }*/
  567.  
  568. if ((g==i)&&(end=1))
  569.                 {
  570.                     printf("congratulations you have completed the game!\n");
  571.             printf("And your total score is....%d",score);
  572.             printf("out of %d\n",questions);
  573.                 }
  574.            
  575.         else if(count>2)
  576.                 {
  577.                     printf("###########GAME OVER#########\n");
  578.             printf("And your total score is....%d",score);
  579.             printf("out of %d\n",questions);
  580.                     getchar();
  581. }
  582. }
  583. }
  584. }
  585.  
  586.  
  587.  
  588. void putchar(char c)                //write character to lcd or serial port
  589. }
  590.         while(!TI);  /* wait for ready */
  591.         TI=0;
  592.         SBUF = c;
  593.  
  594. }
  595.  
  596. char getchar()              // get character from serial port
  597. {
  598.     char c;
  599.     while(!RI);
  600.     RI =0;
  601.     c = SBUF;
  602.     return (c);
  603. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement