Found 361 repositories(showing 30)
mactavish10
Hangman(2-Player) Game in C++ using Classes
hammadmeer-dev
Hangman Game Project in Cpp . Intermediate Level University Project using file Handling.
irtza46
Hangman game (C++)
pkprajapati7402
A simple C++ command-line implementation of the classic Hangman game. Guess the hidden word letter by letter before running out of attempts. This project provides an interactive and enjoyable way to practice basic programming concepts.
Manraj29
Basic game of Hangman (Guess the word in limited guesses)
connorcarpenter15
A primitive hangman game coded in C++ and run in the command line.
dev-gseven
The Hangman Game on your Terminal.
khaint2512
// hangman.cpp #include <iostream> #include <cstdlib> #include <ctime> using namespace std; const int MAX_BAD_GUESS = 7; const string WORD_LIST[]= {"angle", "ant", "apple", "arch", "arm", "army", "baby", "bag", "ball", "band", "basin", "basket", "bath", "bed", "bee", "bell", "berry", "bird", "blade", "board", "boat", "bone", "book", "boot", "bottle", "box", "boy", "brain", "brake", "branch", "brick", "bridge", "brush", "bucket", "bulb", "button", "cake", "camera", "card", "cart", "carriage", "cat", "chain", "cheese", "chest", "chin", "church", "circle", "clock", "cloud", "coat", "collar", "comb", "cord", "cow", "cup", "curtain", "cushion", "dog", "door", "drain", "drawer", "dress", "drop", "ear", "egg", "engine", "eye", "face", "farm", "feather", "finger", "fish", "flag", "floor", "fly", "foot", "fork", "fowl", "frame", "garden", "girl", "glove", "goat", "gun", "hair", "hammer", "hand", "hat", "head", "heart", "hook", "horn", "horse", "hospital", "house", "island", "jewel", "kettle", "key", "knee", "knife", "knot", "leaf", "leg", "library", "line", "lip", "lock", "map", "match", "monkey", "moon", "mouth", "muscle", "nail", "neck", "needle", "nerve", "net", "nose", "nut", "office", "orange", "oven", "parcel", "pen", "pencil", "picture", "pig", "pin", "pipe", "plane", "plate", "plow", "pocket", "pot", "potato", "prison", "pump", "rail", "rat", "receipt", "ring", "rod", "roof", "root", "sail", "school", "scissors", "screw", "seed", "sheep", "shelf", "ship", "shirt", "shoe", "skin", "skirt", "snake", "sock", "spade", "sponge", "spoon", "spring", "square", "stamp", "star", "station", "stem", "stick", "stocking", "stomach", "store", "street", "sun", "table", "tail", "thread", "throat", "thumb", "ticket", "toe", "tongue", "tooth", "town", "train", "tray", "tree", "trousers", "umbrella", "wall", "watch", "wheel", "whip", "whistle", "window", "wire", "wing", "worm"}; const int WORD_COUNT = sizeof (WORD_LIST) / sizeof (string) ; const string FIGURE[] = { " ------------------ \n" " | \n" " | \n" " | \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | \n" " | \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | / \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | / \\ \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | /|\\ \n" " | \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | /|\\ \n" " | / \n" " | \n" " | \n" " | \n" " ----- \n", " ------------------ \n" " | | \n" " | O \n" " | /|\\ \n" " | / \\ \n" " | \n" " | \n" " | \n" " ----- \n", }; string chooseWord(){ int randomIndex = rand() % WORD_COUNT; return WORD_LIST[randomIndex]; } void renderGame (string guessWord , int badGuessCount){ cout << FIGURE[badGuessCount] << endl; cout << "Current guessed word is :" << guessWord << endl; cout << "Number or bad guess is:" << badGuessCount << endl; } char readAGuess(){ char guess; cout << "Your guess ?" << endl; cin >> guess ; return guess; } bool contains (string word , char guess){ return word.find_first_of(guess) != string::npos; } string update(string guessWord, string word, char guess){ for(size_t i=0; i< word.length();i++){ if(word[i] == guess) guessWord[i] = guess; } return guessWord; } int main(){ srand(time(0)); string word = chooseWord(); string guessWord = string (word.length (), '-'); int badGuessCount = 0; do { renderGame (guessWord, badGuessCount); char guess = readAGuess(); if (contains (word, guess)) guessWord = update (guessWord, word, guess); else badGuessCount++; } while (badGuessCount < MAX_BAD_GUESS && word != guessWord); renderGame (guessWord, badGuessCount); if (badGuessCount < MAX_BAD_GUESS) cout << "You win ! The word is " << guessWord << endl; else cout << "Game over ! The correct word is " << word << endl; }
CM0use
Hangman, no 3D or third-party libraries, just the standard functions provided by the compiler.
Loksta8
Hangman is a fun game that I thought would be cool to make back when I was first learning how to code. What I didn't know back then was how to program in the object oriented style via .h and .cpp files separately. I created it back in 2011 I believe but it wasn't Object Oriented. So I created this in the OO style. I'll upload both styles to see the evolution and so everyone else can learn as well. Eventually I'd like to create a huge text file that the program can read from and randomly pick words from that instead of the pre-defined words I have inside of this program already. Feel free to add or change the words and program to your liking. Thanks for checking it out! I hope you enjoy it!
xrem
Виселица
sky9891
Hangman Game built using C++
Jen135790
A simple game of Hangman written in C++ and played on the console. This game has a special twist!
JuliusVSt
Test Projekt in C++
KonnerEL
CPP + Windows Forms Implementation of Hangman.
isaac-diniz
Hangman game done with cpp, complementary exercise
NomarCub
No description available
marvelboyop
A simple Hangman game made in C++ language
nutthawitkrub
No description available
aisrael615
Practice programs in C++
bhardwaj-kushagra
Tried to implement the famous Hangman game in C++. Took longer than expected but it all made sense afterwards. Great project for learning.
NghiaVu183
No description available
kandhan-kuhan-t
No description available
xrimsonn
hangman game
fcostin
weakly solving adversarial hangman
gabriel-dp
Hangman Game (Jogo da Forca) made with C++ to run on console. Play with a friend!
riskAnalystAjay
Word guessing game (Hangman) written in cpp with random word selection
liyinan1001
a hangman ai using naive bayes
Ogshub
a hangman inspired game made using c++ (for practise purpose).
RonnyGST
Hangman game made in c++ based on arrays