Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- YOU ARE DOING IT FUCKING WRONG.
- - S.
- */
- #include <stdio.h>
- #include<8051.h>
- #include <stdlib.h>
- char getchar();
- void putchar(char c);
- unsigned char delay();
- void main()
- {
- 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;
- h=1;
- i=0;
- j=3;
- k=7;
- l=4;
- count=0;
- score=0;
- questions=0;
- printf("#WELCOME TO THE MATHS GAME!#\n");
- printf("#WHERE YOUR MATHS KNOWLEDGE IS TESTED!#\n");
- printf("INFO:YOU HAVE 'THREE' LIVE LINES!\n");
- printf("INFO:GET THREE WRONG AND ITS GAMEOVER!!\n");
- printf("TRUE=1, FALSE=0\n");
- printf("Is 5>4 ?\n");
- questions=questions+1;
- x=getchar();
- if (x==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (x==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(x>1)
- {
- printf("Is 5>4 ?\n");
- printf("True=1!, False=0!\n");
- x=getchar();
- if (x==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (x==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- if (count<3)
- {
- printf("Is 2x3=6\n");
- questions=questions+1;
- y=getchar();
- if (y==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (y==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(y>1)
- {
- printf("Is 2x3=6\n");
- printf("True=1!, False=0!\n");
- y=getchar();
- if (y==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (y==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- }
- if (count<3)
- {
- printf("How many sides does a heptagon have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- n=getchar();
- if (n==k)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (n==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (n==l)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if((n!=3)&&(n!=4))
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a heptagon have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- n=getchar();
- if (n==k)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (n==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (n==l)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(n!=7)
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a heptagon have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- n=getchar();
- if (n==k)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (n==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (n==l)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- if (count<3)
- {
- printf("Is 1+1=2\n");
- questions=questions+1;
- z=getchar();
- if (z==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (z==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(z>1)
- {
- printf("Is 1+1=2\n");
- printf("True=1!, False=0!\n");
- z=getchar();
- if (z==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (z==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- if (count<3)
- {
- printf("Is 1+4=7\n");
- questions=questions+1;
- a=getchar();
- if (a==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (a==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if(a>1)
- {
- printf("Is 1+4=7\n");
- printf("True=1!, False=0!\n");
- a=getchar();
- if (a==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (a==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- }
- if (count<3)
- {
- printf("Is 3-2=10\n");
- questions=questions+1;
- b=getchar();
- if (b==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (b==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if(b>1)
- {
- printf("Is 3-2=10\n");
- printf("True=1!, False=0!\n");
- b=getchar();
- if (b==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (b==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- }
- if (count<3)
- {
- printf("Is 64^(1/2)=8\n");
- questions=questions+1;
- c=getchar();
- if (c==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (c==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(c>1)
- {
- printf("Is 64^(1/2)=8\n");
- printf("True=1!, False=0!\n");
- c=getchar();
- if (c==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (c==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- if (count<3)
- {
- printf("How many sides does a triangle have?\n");
- printf("A=3....B=1....C=7\n");
- questions=questions+1;
- m=getchar();
- if (m==j)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (m==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (m==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if((m!=3)&&(m!=1))
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a triangle have?\n");
- printf("A=3....B=1....C=7\n");
- m=getchar();
- if (m==j)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (m==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (m==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(m!=7)
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a triangle have?\n");
- printf("A=3....B=1....C=7\n");
- m=getchar();
- if (m==j)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (m==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (m==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- if (count<3)
- {
- printf("Is 4/6=2/3\n");
- questions=questions+1;
- d=getchar();
- if (d==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (d==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(d>1)
- {
- printf("Is 4/6 = 2/3?\n");
- printf("True=1!, False=0!\n");
- d=getchar();
- if (d==h)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (d==i)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- if (count<3)
- {
- printf("How many sides does a square have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- o=getchar();
- if (o==l)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (o==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (o==j)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if((o!=3)&&(o!=4))
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a square have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- o=getchar();
- if (o==l)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (o==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (o==j)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if(o!=7)
- {
- printf("Number outside of range!!!!!\n");
- printf("How many sides does a square have?\n");
- printf("A=3....B=4....C=7\n");
- questions=questions+1;
- n=getchar();
- if (o==l)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if (o==k)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (o==j)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- }
- }
- if (count<3)
- {
- printf("Is 7>9\n");
- questions=questions+1;
- e=getchar();
- if (e==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (e==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if(e>1)
- {
- printf("Is 7>9\n");
- printf("True=1!, False=0!\n");
- e=getchar();
- if (e==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (e==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- }
- if (count<3)
- {
- printf("Is 5-3=23\n");
- questions=questions+1;
- f=getchar();
- if (f==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (f==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- else if(f>1)
- {
- printf("Is 5-3=23\n");
- printf("True=1!, False=0!\n");
- f=getchar();
- if (f==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (f==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- }
- }
- if (count<3)
- {
- printf("Is 4x5=0\n");
- questions=questions+1;
- g=getchar();
- if (g==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (g==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- end=1;
- }
- else if(g>1)
- {
- printf("Is 4x5=0\n");
- printf("True=1!, False=0!\n");
- g=getchar();
- if (g==h)
- {
- printf("WRONG!\n");
- count=count+1;
- }
- else if (g==i)
- {
- printf("CORRECT!\n");
- score=score+1;
- end=1;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- /*unsigned char delay(void)
- {
- unsigned char q=0xFF;
- while(q)
- q--;
- }*/
- if ((g==i)&&(end=1))
- {
- printf("congratulations you have completed the game!\n");
- printf("And your total score is....%d",score);
- printf("out of %d\n",questions);
- }
- else if(count>2)
- {
- printf("###########GAME OVER#########\n");
- printf("And your total score is....%d",score);
- printf("out of %d\n",questions);
- getchar();
- }
- }
- }
- }
- void putchar(char c) //write character to lcd or serial port
- }
- while(!TI); /* wait for ready */
- TI=0;
- SBUF = c;
- }
- char getchar() // get character from serial port
- {
- char c;
- while(!RI);
- RI =0;
- c = SBUF;
- return (c);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement