metalsvm/newlib/examples/hangman.c

42 lines
832 B
C
Raw Normal View History

2011-05-23 13:47:05 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int Spiel ()
{
//Variablen
char* Wort = malloc(100*sizeof(char));
char* Raten = malloc(100*sizeof(char));;
int Versuche = 10;
printf("Spieler 1 geben sie das Wort ein :");
scanf("%s", Wort);
printf("\n\nNun, Spieler 2 errate bitte das Wort\n");
while(Raten!=Wort && Versuche > 0){
printf("Deine Antwort:");
scanf("%s", Raten);
if(!strcmp(Raten,Wort))
{
printf("ToLL! Das Wort ist richtig");
return 0;
}
else
{
printf("Schade das Wort ist falsch");
}
Versuche--;
}
return 0;
}//Spielen
int main(int argc, char** argv)
{
Spiel();
}