Permalink
Piedra Papel o Tijera, Chihuahua (Chihuahua). PAPELERIA Y MERCERIA: - ENVOLTURA DE REGALOS - DETALLES PARA TODA OCASION (PEWTER) - ENGARGOLADO - FORRADO DE LIBROS - SURTIMOS LISTAS.
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Piedra Papel O Tijera En Dev C Plus
Sign upBranch:master
Find file Copy path
Piedra Papel Y Tijera
Fetching contributors…
| # include<stdio.h> |
| # include<conio.h> |
| # include<stdlib.h> |
| intmain (void) |
| { |
| int jug, maq, op, r; |
| printf('Hola, jugaremos pidra, papel o tijeran'); |
| do{ |
| printf('Para jugar ingresaras solo el numero que corresponda a tu eleccion:n'); |
| srand(time(NULL)); |
| r=rand()%3; |
| printf('0-------Piedran'); |
| printf('1-------Papeln'); |
| printf('2-------Tijerasn'); |
| printf('Selecciona un numero del anterior menun'); |
| scanf('%d', &jug); |
| switch (jug) |
| { |
| case0: |
| printf('Elegiste Piedran'); |
| if (r0) |
| { |
| printf('tElegi Piedrann'); |
| printf('tttEmpatennn'); |
| } |
| else |
| { |
| if (r1) |
| { |
| printf('tElegi Papelnn'); |
| printf('tttGana la computadorannn'); |
| } |
| else |
| { |
| if (r2) |
| { |
| printf('tElegi Tijerasnn'); |
| printf('tttTu ganasnnn'); |
| } |
| } |
| } |
| break; |
| case1: |
| printf('Elegiste Papeln'); |
| if (r0) |
| { |
| printf('tElegi Piedrann'); |
| printf('tttTu ganasnnn'); |
| } |
| else |
| { |
| if (r1) |
| { |
| printf('tElegi Papelnn'); |
| printf('tttEmpatennn'); |
| } |
| else |
| { |
| if (r2) |
| { |
| printf('tElegi Tijerasnn'); |
| printf('tttGana la computadorannn'); |
| } |
| } |
| } |
| break; |
| case2 : |
| printf('Elegiste Tijerasn'); |
| if (r0) |
| { |
| printf('tElegi Piedrann'); |
| printf('tttGana la computadorannn'); |
| } |
| else |
| { |
| if (r1) |
| { |
| printf('tElegi Papelnn'); |
| printf('tttTu ganasnnn'); |
| } |
| else |
| { |
| if (r2) |
| { |
| printf('tElegi Tijerasnn'); |
| printf('tttEmpatennn'); |
| } |
| } |
| } |
| break; |
| default: |
| printf('Por favor solo introduce los numeros que aparecen en el menu'); |
| } |
| printf('Quieres volver a jugar?n'); |
| printf('Si deseas volver a jugar presiona 1n'); |
| printf('Si deseas salir del juego presiona 2n'); |
| scanf('%d', &op); |
| system('cls'); |
| } |
| while(op1); |
| printf('Ok, hasta luego, regresa pronto'); |
| getch(); |
| } |
Copy lines Copy permalink