Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int array[3] = {0,0,1};
- void delay()
- {
- for(int i=0;i<1000000;i++)
- for(int j=0;j<100;j++);
- }
- void view(int j)
- {
- delay();
- system("cls");
- printf("-------\n|");
- for(int i=0;i<3;i++)
- {
- if(i == j)
- printf("#|");
- else if(array[i]==1)
- printf("G|");
- else if(array[i]==0)
- printf(" |");
- }
- printf("\n-------\n");
- }
- bool find_1(int j)
- {
- view(j);
- if(j < 3)
- {
- if(array[j] == 1)
- {
- array[j] = 0;
- view(j);
- return 1;
- }
- else
- {
- int temp = find_1(j+1);
- view(j);
- return temp;
- }
- }
- else
- {
- view(j);
- return 0;
- }
- }
- int main()
- {
- if(find_1(0))
- printf("Got Gold\n");
- else
- printf("Got Nothing\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment