Código de C/Visual C - El juego del ahorcado en C

Versión 1
estrellaestrellaestrellaestrellaestrella(26)

Publicado el 4 de Junio del 2002gráfica de visualizaciones de la versión: Versión 1
42.786 visualizaciones desde el 4 de Junio del 2002
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<math.h>
#include<ctype.h>
 
#define TRUE 1
#define FALSE 0
void imprimir(int oport, char *wordserr,char *word);
int found_word(char letra);
int menu(void);
int exist_word(char letra);
char *adivina(void)
{
	char *diccionario[]={"LEON","MANAGUA","CORINTO","PARIS","CANADA",
			     "PERRO","GATO","CONEJO","ZORRO","CABALLO","PEZ",
			     "MARTILLO","CLAVO","LAPIZ","MADERA","PEGA","CASA",
			     "SILLA","MESA","COMEDOR","TABLA","PESAS","BARCO",
			     "LANCHA","PESCA","ZAPATO","BICICLETA","AUTOBUS",
			     "TRICICLO","MEXICO","LICENCIA","BEISBOL","FUTBOL",
			     "BASKET","TENNIS","NATACION","MARATON","BALONMANO",
			     "COMPUTADORA","POLO","HARDWARE","SOFTWARE","IMPRIMIR",
			     "DISCO","FOTO","MARCO","GRANDEZA","PEQUE¥O","MOVIMIENTO",
			     "CAZADOR","BALLENATO","NOCHE","DIA"};
	int num;
	srand( (unsigned)time( NULL ) );
	num=rand()%50;
	return(diccionario[num]);
}
 
char *cadena, palabra[10], letraserror[10];
main(){
	int i, cont=0,game_over=FALSE, oportunidades, acierto=FALSE, existe;
	int opc=0;
	char letra;
	system("cls");
	opc=menu();
	do{
	system("cls");
	switch(opc){
		case 1:
			cadena=adivina();
			strcpy(palabra,cadena);
			oportunidades=6;
			for(i=0;i<strlen(cadena);i++) palabra[i]='_';
			for(i=cont;i>=0;i--) letraserror[i]='\0';
			cont=0;
			do{
				do{
					fflush(stdin);
					system("cls");
					existe=acierto=FALSE;
					imprimir(oportunidades,letraserror,palabra);
					printf("\n\n\t Letra?: ");scanf("%c",&letra);
					existe=exist_word(letra);
				}while(existe);//fin do while
					acierto=found_word(letra);
					if(acierto){
						if(strcmp(palabra, cadena)!=0){game_over=FALSE; continue;}
						else game_over=TRUE;
					}//fin if.
					else {
						letraserror[cont++]=letra;
						--oportunidades;
					}//fin else.
			}while(oportunidades>0&&game_over==FALSE);//fin do while.
			system("cls");
			if(game_over&&oportunidades>4){
				imprimir(oportunidades,letraserror,palabra);
				printf("\n\tEXCELENTE TRABAJO!");}//fin if.
			else if(game_over&&oportunidades>2){
				imprimir(oportunidades,letraserror,palabra);
				printf("\n\tMUY BUEN TRABAJO!");}//fin else if.
			else if(game_over){
				imprimir(oportunidades,letraserror,palabra);
				printf("\n\tHas ganado!!");}//fin else if.
			else {  printf("\n\tAHORCADO, JEJEJE!\n\n\t");
				printf("\La palabra era...\n\n\t");
				for(i=0;i<strlen(cadena);i++) printf(" %c",cadena[i]);
			}//fin else.
			game_over=FALSE;
			break;//fin case 1.
		case 2: exit(0);break;//fin case 2.
	}//fin switch.
	fflush(stdin);
	opc=menu();
	}while(opc==1);
}
void imprimir(int oport, char *wordserr,char *word)
{  int i;
   printf("\n\n\tJuego del Ahorcado\n\n\n\t");
   if(oport<6){
	printf("\n\n\tLetras erradas: ");
	for(i=0;i<strlen(wordserr);i++) printf(" %c",wordserr[i]);
   }
   printf("\n\n\t");
   for(i=0;i<strlen(cadena);i++) printf(" %c",word[i]);
   printf("\n\n\tOportunidades= %d\n",oport);
}
int menu(void)
{      int opcion;
       printf("\n\n\tJuego del Ahorcado\n\n\n\t\\
		\n\t1. Jugar\n\\
		\n\t2. Salir\n\\
		\n\t Elegir la opci¢n: ");
     scanf("%d",&opcion);
     return(opcion);
}
int found_word(char letra)
{
	int acierto=FALSE,i;
	letra=toupper(letra);
	for(i=0;i<strlen(cadena);i++){
		if(letra==cadena[i]){
			palabra[i]=letra;
			acierto=TRUE;}
	}
	return(acierto);
}
int exist_word(char letra)
{
	int existe=FALSE,i;
	for(i=0;i<strlen(letraserror);i++){
		if(letra==letraserror[i]) {
			printf("\nYa la escribistes!.\n");
			existe=TRUE;
			system("pause");
		}
	}
	return(existe);
}



Comentarios sobre la versión: Versión 1 (26)

7 de Junio del 2002
estrellaestrellaestrellaestrellaestrella
Regular, tiene varios errores....
Responder
31 de Agosto del 2023
estrellaestrellaestrellaestrellaestrella
how to download cinema hd on firestick
Responder
11 de Julio del 2002
estrellaestrellaestrellaestrellaestrella
tiene muchos errrores,me podrias mandar el codigo fuente y el ejecutable .

gracias
Responder
12 de Julio del 2002
estrellaestrellaestrellaestrellaestrella
Exelente, en verdad me parecio bueno. lo recomiendo.
Responder
15 de Octubre del 2002
estrellaestrellaestrellaestrellaestrella
No me jalo nada, crei que iba a correr pero no. Maraca como 27 errores y
17 Warring. No lo recomiendo mucho, me tarde como 3 horas codificandolo y
corrigiendolo y aun asi no jalo, ya no la haces, mejor mandame el ejecutable
para ver como era, Ok?
Responder
28 de Mayo del 2003
estrellaestrellaestrellaestrellaestrella
Muy bueno, me sacaste de un apuro. solo hay que corregir un par de errores que son evidentes (backslash) y compila perfecto.
Responder
13 de Enero del 2004
estrellaestrellaestrellaestrellaestrella
estuvo muy chido el programa
Responder
23 de Mayo del 2007
estrellaestrellaestrellaestrellaestrella
Me gusto mucho y me corrio perfecto!! buen trabajo
Responder
20 de Agosto del 2009
estrellaestrellaestrellaestrellaestrella
Excelente codigo gracias por tu tiempo para postearlo
Responder
25 de Enero del 2011
estrellaestrellaestrellaestrellaestrella
ami me funciona bien , solo corregir algunos () y algun ; y perfect , gracias.
Responder
7 de Diciembre del 2011
estrellaestrellaestrellaestrellaestrella
esta buenisimo el programa me fue de mucha ayuda...
Responder
14 de Octubre del 2012
estrellaestrellaestrellaestrellaestrella
Buen aporte brother!
Responder
10 de Diciembre del 2012
estrellaestrellaestrellaestrellaestrella
A mi me ha venido genial. Muchas gracias.
Responder
2 de Junio del 2013
estrellaestrellaestrellaestrellaestrella
esta fino el programa.. me corrió a la perfección... me podrías pasar un tuto o las instrucciones como creaste el juego . mi proyecto final es dentro de un mes es sobre el juego del ahorcado pero no tengo idea su realización.. gracias de antemano
Responder
Aranxa
27 de Mayo del 2015
estrellaestrellaestrellaestrellaestrella
hola amm y como puedo poner para que valla apreciendo el muñequito?
Responder
Jose Pinto
4 de Noviembre del 2017
estrellaestrellaestrellaestrellaestrella
Hola,esta buenísimo el programa, tienes las instrucciones o algún tutorial de como hiciste el programa?
desde ya, gracias
Responder
Percy
17 de Febrero del 2023
estrellaestrellaestrellaestrellaestrella
¡Hola! Me gustaría darle las gracias por visitar nuestro sitio web. Si está buscando un juego nuevo, me gustaría presentarle un juego interesante que es [url]carx street apk[/url]https://apkcima.com/es/carx-street/. Puedes descargar este juego desde la tienda de aplicaciones en tu teléfono o en tu computadora. Una vez descargado e instalado, puedes empezar a jugar y unirte a la tripulación de la nave espacial, o convertirte en un pícaro del equipo. ¡Diviértete jugando!
Responder
LavoneMerriman
21 de Septiembre del 2023
estrellaestrellaestrellaestrellaestrella
Do you know how to minecraft apk download? Can you guide me?
Responder
EarnestDavis
12 de Octubre del 2023
estrellaestrellaestrellaestrellaestrella
Estos juegos se pueden encontrar con archivos APK gratuitos desde apkclasico.com
Responder
John Kelly
30 de Diciembre del 2023
estrellaestrellaestrellaestrellaestrella
Puedo escuchar música en Spotify Premium APK. ¿Existen otras aplicaciones similares?
Responder
Corn Planter Cost
13 de Febrero del 2024
estrellaestrellaestrellaestrellaestrella
I am happy to find this article content very helpful and valuable for everyone, as it contains lot of topic information.
[https://zeeshanagro.com/corn-planter-machine/]Corn Planter Cost[https://zeeshanagro.com/corn-planter-machine/]
Responder
Exper TV Apk Android için
13 de Febrero del 2024
estrellaestrellaestrellaestrellaestrella
This blog post is absolutely fantastic! The content is insightful and well-researched, and your writing style is engaging and easy to follow. I love how you provide practical tips that can be applied right away. Keep up the great work!
<a href="https://inattvpros.com/exper-tv-apk-1/">Exper TV Apk Android için</a>
Responder
Mortal Kombat
13 de Febrero del 2024
estrellaestrellaestrellaestrellaestrella
Amazing Article!! This is really informative and knowledgeable for us, so thank you for sharing this information with us, it will really work. Love Your Blog.
[url]Mortal Kombat[https://yallashootro.com/mortal-kombat-mod-apk/]
Responder
Shadow Fight 2 APK Versi Terbaru
13 de Febrero del 2024
estrellaestrellaestrellaestrellaestrella
Amazing Article!! This is really informative and knowledgeable for us, so thank you for sharing this information with us, it will really work. Love Your Blog.
https://apkmaya.com/shadow-fight-2-apk/
Responder
https://licenseapps.com/audials-one-crack/
21 de Febrero del 2024
estrellaestrellaestrellaestrellaestrella
This post is not just informative but impressive also. It is really what I wanted to see hope in future you will continue for sharing such an excellent post.
<a href="https://licenseapps.com/audials-one-crack/">Audials One</a>
<a href="https://licenseapps.com/winx-mediatrans-crack/">WinX MediaTrans</a>
<a href="https://crackist.com/whatsender-pro-crack/">WhatSender Pro</a>
<a href="https://crackist.com/easeus-video-editor-crack/">EaseUS Video Editor</a>
<a href="https://plugin-torrent.com/sony-vegas-pro-19-crack/">Sony Vegas</a>
<a href="https://plugin-torrent.com/reveal-sound-spire-for-mac/">Reveal Sound Spire</a>
<a href="https://vst-crack.com/korg-triton-vst-free-download-mac-vst-crack/">Korg Triton VST</a>
<a href="https://vst-crack.com/bulk-image-downloader-crack/">Bulk Image Downloader</a>
Responder
KaraHarmon
8 de Abril del 2024
estrellaestrellaestrellaestrellaestrella
¿Por qué no intentamos aplicar esta idea al juego Minecraft APK?
Responder

Comentar la versión: Versión 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s217