begin process at 2010 03 13 16:47:33
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Jeux

 > THE PENDU QUI TUE

THE PENDU QUI TUE


 Information sur la source

Note :
Aucune note
Catégorie :Jeux Niveau :Débutant Date de création :31/07/2001 Date de mise à jour :20/12/2001 18:18:20 Vu / téléchargé :3 520 / 260

Auteur : Kreator

Ecrire un message privé
Site perso
Commentaire sur cette source (0)
Ajouter un commentaire et/ou une note

 Description

Un pendu avec un dictionnaire (dans le switch(h) )
un peu petit mais très facilement extensible:

Source

  • #include "dico.h"
  • void main()
  • {
  • int vie_=3;
  • START: do
  • {
  • char mot[32],mot_d[32];
  • char *mot_devine=(char*)malloc(sizeof(char));
  • char *mon_mot=(char*)malloc(sizeof(char));
  • char lettre;
  • int h,i,vie=9,test=1;
  • time_t s;
  • clrscr();
  • srand( (unsigned) time (&s) );
  • h=rand()%40;
  • mot_devine=DICTIONNAIRE[h];
  • strcpy(mot_d,mot_devine);
  • for(i=0;i<int(strlen(mot_devine));i++)
  • mot[i]='-';
  • do {
  • clrscr();
  • mot[i]='\0';
  • if(test==0)
  • vie--;
  • for(i=0;i<int(strlen(mot_devine));i++)
  • printf("%c",mot[i]);
  • gotoxy(65,1);printf("VIE(S): %d",vie_);
  • gotoxy(65,2);printf("LETTRE(S): %d",vie);
  • if( (strcmp(mon_mot,mot_devine))==0 )
  • {
  • clrscr();
  • gotoxy(35,10);printf("GAGNE");
  • vie=0;
  • getch();
  • goto START;
  • }
  • printf("\n\nVotre lettre: ");
  • scanf(" %c",&lettre);
  • if(lettre>90)
  • lettre=lettre-32;
  • test=0;
  • for(i=0;i<int(strlen(mot_devine));i++)
  • if(lettre==mot_d[i])
  • {mot[i]=lettre;test=1;}
  • else
  • if(mot[i]=='-')
  • mot[i]='-';
  • strcpy(mot_devine,mot_d);
  • strcpy(mon_mot,mot);
  • } while(vie>0);
  • clrscr();
  • gotoxy(32-strlen(mot_devine),10);printf("PERDU\t:\t%s",mot_devine);
  • vie_--;
  • getch();
  • }
  • while(vie_>0);
  • }
#include "dico.h"

void main()
{
int vie_=3;

START:	do
		{
			char mot[32],mot_d[32];
			char 	*mot_devine=(char*)malloc(sizeof(char));
			char	*mon_mot=(char*)malloc(sizeof(char));
			char lettre;
			int h,i,vie=9,test=1;
			time_t s;
			
			clrscr();
			
			srand( (unsigned) time (&s) );
			h=rand()%40;
			mot_devine=DICTIONNAIRE[h];
			
			strcpy(mot_d,mot_devine);
			
			for(i=0;i<int(strlen(mot_devine));i++)
				mot[i]='-';
			
			do	{
			clrscr();
			
			
			mot[i]='\0';
			
			if(test==0)
				vie--;
			
			for(i=0;i<int(strlen(mot_devine));i++)
				printf("%c",mot[i]);
			
			gotoxy(65,1);printf("VIE(S): %d",vie_);
			gotoxy(65,2);printf("LETTRE(S): %d",vie);
			
			
			if( (strcmp(mon_mot,mot_devine))==0 )
				{
			   clrscr();
			   gotoxy(35,10);printf("GAGNE");
				vie=0;
			   getch();
			   goto START;
			   }
			
			printf("\n\nVotre lettre: ");
			scanf(" %c",&lettre);
			
			if(lettre>90)
				lettre=lettre-32;
			
			test=0;
			
			for(i=0;i<int(strlen(mot_devine));i++)
			   if(lettre==mot_d[i])
			   	{mot[i]=lettre;test=1;}
				else
			   	if(mot[i]=='-')
						mot[i]='-';
			
			strcpy(mot_devine,mot_d);
			strcpy(mon_mot,mot);
			
			
				}	while(vie>0);
			
			clrscr();
			gotoxy(32-strlen(mot_devine),10);printf("PERDU\t:\t%s",mot_devine);
			vie_--;
			getch();
		}
	while(vie_>0);
}

 Conclusion

En couleur !

Dans le ZIP il y a DICO.H

 Fichier Zip

Les Membres Club peuvent télécharger directement un fichier contenu dans le zip sans télécharger le zip en entier !

Télécharger le zip


 Sources du même auteur

MOTUS
Source avec Zip COMPRESSION HUFFMAN
Source avec Zip IO.SYS
Source avec Zip CHEAT MODE POUR ALERT ROUGE 2
Source avec Zip PIX ANIM

 Sources de la même categorie

Source avec Zip PUISSANCE 4 EN SDL, AVEC SAUVEGARDE , JOUEUR VS JOUEUR OU IA... par diablosephiroth
Source avec Zip Source avec une capture TETRIS 1.0 (C & SDL) par c1702
Source avec Zip Source avec une capture LE PENDU (PAR CRAZYGOODBOY) par CrazyGoodBoy
Source avec Zip Source avec une capture PLUS OU MOINS par antho974
Source avec Zip Source avec une capture TETRIS EN C++ AVEC SDL par Marmalus

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Appels d'offres

Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,562 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales