Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- [img]http://img39.imageshack.us/img39/7388/piedra1.bmp[/img]
- [img]http://img62.imageshack.us/img62/6571/piedra2.png[/img]
- [img]http://img441.imageshack.us/img441/2788/piedra3.png[/img]
- */
- #include <stdio.h>
- #include <windows.h>
- #include <string.h>
- int PuntosMaquina = 0;
- int PuntosJugador = 0;
- char Nombre[15];
- void Jugar();
- int main ()
- {
- using namespace std;
- printf ("*************************************************************\n");
- printf ("** Juego Piedra papel o tijeras By BadyX **\n");
- printf ("*************************************************************\n");
- printf("\nIntroduce tu nombre:\n");
- scanf("%s",&Nombre);
- Jugar();
- return 0;
- }
- void Jugar()
- {
- srand(GetTickCount());
- int i;
- char Eleccion[7];
- char Respuesta;
- do
- {
- system("cls");
- printf( "[Resultado] Maquina %d %s %d.\n",PuntosMaquina, Nombre ,PuntosJugador);
- printf("\nEscriba su eleccion:\nPiedra papel o tijeras\n");
- gets(Eleccion);
- if (strcmp(Eleccion,"piedra")== 0)
- {
- printf(" \nUsted escogio piedra:");
- i = (rand()% 3) + 1;
- if (i==1)
- {
- printf("\nEl ordenador escogio piedra y enpataron.");
- }
- if(i==2)
- {
- printf("\nEl ordenador escogio papel y te gano.");
- PuntosMaquina ++;
- }
- if(i==3)
- {
- printf("\nEl ordenador escogio tijeras y ganaste.");
- PuntosJugador ++;
- }
- }
- if (strcmp(Eleccion,"tijeras")== 0)
- {
- printf("\nUsted escogio tijeras:");
- i = (rand()% 3) + 1;
- if (i==1)
- {
- printf("\nEl ordenador escogio piedra y perdiste");
- PuntosMaquina ++;
- }
- if(i==2)
- {
- printf("\nEl ordenador escogio papel y le ganaste");
- PuntosJugador ++;
- }
- if(i==3)
- {
- printf("\nEl ordenador escogio tijeras y empatasteis");
- }
- }
- if (strcmp(Eleccion,"papel")== 0)
- {
- printf("\nUsted escogio papel:");
- i = (rand()% 3) + 1;
- if (i==1)
- {
- printf("\nEl ordenador escogio piedra y ganaste");
- PuntosJugador ++;
- }
- if(i==2)
- {
- printf("\nEl ordenador escogio papel y empatasteis");
- }
- if(i==3)
- {
- printf("\nEl ordenador escogio tijeras y perdistes");
- PuntosMaquina ++;
- }
- }
- printf("\n\nQuiere seguir jugando?.(S/N)");
- scanf("%c",&Respuesta);
- setbuf ( stdin, NULL );
- }
- while ((Respuesta =='S') || (Respuesta =='s'));
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment