void handle_user(int newfd) { current_user_t* loggedInUser = userLogin(newfd); int loggedIn = loggedInUser->loggedIn; if (loggedIn == 1) { userpw_t* User = loggedInUser->user; int option; do { option = receive_number(newfd); switch(option) { case 1: play_hangman(newfd, User); break; case 2: sendLeaderboard(newfd); break; default: option = 3; break; } // do things } while (option != 3); loggedIn = 0; } else { perror("User not logged in"); //exit(1); // user login failed } //return void; }
int main() { char hiddenword[7]; int wordsize; printf("Enter a word (up to 6 letters): "); scanf("%s",hiddenword); wordsize = strlen(hiddenword); printf("\n"); printf("Welcome to H A N G M A N"); printf("\n"); play_hangman(hiddenword, wordsize); return 0; }
int main() { //Store the word the user enters char storedstring[7]; //Player 1 enters the secret word printf("Enter a word (up to 6 letters): "); //save the string scanf("%6s",storedstring); //Show the first messages to the user who sets up the game printf("\n"); printf("Welcome to H A N G M A N\n"); //Start the game routine play_hangman(storedstring); return 0; }