Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
- #include <math.h>
- int main(void) {
- char inputString[50];
- printf("Welcome to hangman! This game requires 2 players.\n");
- printf("Enter a string that is less than 50 characters and only lowercase letters.\n");
- printf("Please enter a string for other player to guess: ");
- scanf("%s", inputString);
- system("clear");
- char currentGuess;
- int i;
- int j = 0;
- int length = strlen(inputString);
- char weird = inputString[0];
- for (i = 0; i < 5; i++) {
- printf("Enter character to guess:");
- scanf("%s", ¤tGuess);
- for (j = 0; j < length; j++) {
- if (inputString[j] == currentGuess) {
- printf("Correct character!\n");
- }
- else {
- printf("Incorrect character.\n");
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement