Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include<time.h>
- #include<conio.h>
- int main()
- {
- printf("1. Play Game?\n2. Exit.\nEnter Choice: ");
- int n,a,b,c,d,e,f,g,rand1,rand2,rand3,ans;
- scanf("%d",&n);
- for(;n=1;){
- start:
- srand(time(0));
- a = (rand() % 1000);
- b = (rand() % 1000);
- c = (rand() % 1000);
- d = (rand() % 1000);
- e = (rand() % 1000);
- f = (rand() % 1000);
- g = (rand() % 1000);
- printf("First number: %d\nPress any key to proceed to the next number...\n",a);
- getch();
- printf("Second number: %d\nPress any key to proceed to the next number...\n",b);
- getch();
- printf("Third number: %d\nPress any key to proceed to the next number...\n",c);
- getch();
- printf("Fourth number: %d\nPress any key to proceed to the next number...\n",d);
- getch();
- printf("Fifth number: %d\nPress any key to proceed to the next number...\n",e);
- getch();
- printf("Sixth number: %d\nPress any key to proceed to the next number...\n",f);
- getch();
- printf("Seventh number: %d\nPress any key to proceed to the questions...\n",g);
- getch();
- jump:
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the first number? %d %d %d %d\nAnswer: ",rand1,rand2,a,rand3);
- scanf("%d",&n);
- if(n==a){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the second number? %d %d %d %d\nAnswer: ",rand1,b,rand2,rand3);
- scanf("%d",&n);
- if(n==b){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the third number? %d %d %d %d\nAnswer: ",c,rand1,rand2,rand3);
- scanf("%d",&n);
- if(n==c){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the fourth number? %d %d %d %d\nAnswer: ",rand1,d,rand2,rand3);
- scanf("%d",&n);
- if(n==d){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the fifth number? %d %d %d %d\nAnswer: ",rand1,rand2,e,rand3);
- scanf("%d",&n);
- if(n==e){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the sixth number? %d %d %d %d\nAnswer: ",f,rand1,rand2,rand3);
- scanf("%d",&n);
- if(n==f){
- printf("Correct!!!\n");
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- rand1 = (rand() % 1000);
- rand2 = (rand() % 1000);
- rand3 = (rand() % 1000);
- printf("What was the seventh number? %d %d %d %d\nAnswer: ",rand1,rand2,rand3,g);
- scanf("%d",&n);
- if(n==g){
- printf("Congratulations! You won! Want to play again?\n1. Play Game?\n2. Exit.\n");
- scanf("%d",&n);
- if(n==1){
- continue;
- }
- else{
- return 0;
- }
- }
- else{
- printf("Wrong Answer! Start from the first question!\n");
- goto jump;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement