Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <windows.h>
- #include <ctype.h>
- void gotoxy(int x, int y)
- {
- COORD coord;
- coord.X = x;
- coord.Y = y;
- SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
- }
- int main()
- {
- char word[81], used[14];
- int wrong=0, laenge, _, i;
- char input;
- SetConsoleTitle(" Guess me if u Can! ");
- //printf("\n\n spielst du mit einem Freund oder alleine?");
- //printf(" \n\n [1] alleine"
- // " \n\n [2] mit einem Freund");
- printf("\n\n please insert a word (max. 80 characters): \n\n");
- gets(word);
- laenge=strlen(word);
- printf("\n\n this word has %i characters.\n\n",laenge);
- for(i=0; i<13; i++)
- {
- // for(_=0; _<laenge; _++)
- // printf(" _");
- // printf("\n");
- gotoxy(10,10);
- printf("\n\n please insert a letter now: ");
- input=getch();
- strcpy(used, &input);
- printf("\n\n The following characters are allready used: %c ", used);
- if(strchr(word, input)){
- printf("\n\n %c is in the word\t\t\t\t\t\t\n\n");
- i--;
- }
- else{
- printf("\n\n the letter %c is wrong!\n");
- wrong++;
- printf(" you have %i try",13-wrong);
- }
- }
- system("cls");
- printf("\n\n to many tries.\n\n");
- system("Pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment