begin process at 2012 02 12 07:20:28
  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é :4 615 / 300

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 Source avec une capture JEUX SERPENT par antho974
Source avec Zip Source avec une capture PENDU EN SDL par Damsou91
Source avec Zip STATE MACHINE MODIFICATION MATH BUCKHAM par billybones79
Source avec Zip AUTRE GRILLE DE SUDOKU par Eneur
Source avec Zip Source avec une capture SOKOBAN EN C POUR DÉBUTANT (VERSION AMÉLIORÉE BASÉE SUR LE T... par eustatika

Commentaires et avis

Aucun commentaire pour le moment.

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Février 2012
LMMJVSD
  12345
6789101112
13141516171819
20212223242526
272829    

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 : 1,186 sec (3)

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