Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #define SL 256
- void main(void)
- {
- int variabile_giocatore,variabile_computer,i;
- char variabile[SL];
- printf("Giochiamo. Digita:\n0 per CARTA\n1 per FORBICI\n2 per SASSO.\n");
- for(i=0;i!=1;i++)
- {
- scanf("%s",variabile);
- variabile_giocatore=atoi(variabile);
- if (variabile_giocatore>=3)
- {
- printf("ti piace vincere facile?! Riscrivi:\n");
- i--;
- }
- }
- start:
- printf("Hai inserito questo?\n%d\ndammi conferma con S,s oppure digita N,n\n",variabile_giocatore);
- scanf("%s",variabile);
- switch (variabile[0])
- {
- case 'S' :
- printf("Apposto!\n");
- case 's' :
- printf("Apposto!\n");
- break;
- case 'N' :
- printf("MA SERIO?!\n");
- case 'n' :
- printf("MA SERIO?!\n");
- default: goto start;
- }
- srand(time(NULL));
- variabile_computer=(rand()/((RAND_MAX)/3));
- //printf("var_computer:%d\n",variabile_computer);
- if (variabile_computer==variabile_giocatore)
- printf("PAREGGIO!\n");
- if ((variabile_computer==2) && (variabile_giocatore==0))
- printf("HAI VINTO!");
- else
- {
- if ((variabile_computer>variabile_giocatore) || ((variabile_computer==0) && (variabile_giocatore==2)))
- printf("HAI PERSO!\n");
- else printf("HAI VINTO!\n");
- }
- }
Add Comment
Please, Sign In to add comment