I'm wondering if my code is just a tad too long to post here, but if the only consequence seems to be getting high-level reviews, then that's perfectly fine.This is my implementation of Hangman in C++, split up into a handful of classes. I'm familiar with the syntax of curly brace languages but lack experience with the quirks and specialties of C++, which is why I'm posting my code here asking if it follows the common best practices.Specifically, here's what I'm most interested in knowing:Am I using .h and .cpp files in the right way? I'm declaring methods in the former and defining them in the latter, and I keep them in subfolders called header and src respectively.Is there a widely accepted naming convention for variables and functions? Right now I'm using_underscores for functions (because I plan on doing stuff with Allegro and feel it would make sense to follow its naming scheme), and camelCasing variables because they're easier to distinguish from functions that way.You may or may not notice, but I pretty much ported this code over from a Java version I made earlier. Classes like WordChooser and CharReader may have made more sense there, but in C++ they seem rather too small to deserve being classes of their own. Would they be better off as functions instead, and if so, where should they go? In main.cpp?main.cpp#include <GameManager.h>int main(){    GameManager gm;    gm.start_game();    return 0;}GameManager.h#pragma once#include Hangman.h#include CharReader.hclass GameManager {public:    void start_game();private:    Hangman hangman;    CharReader reader;    char guess;    void play_game();    void handle_guess();    void handle_win();    void handle_lose();    void read_input_into_guess();    void print_game_state_info();    bool handle_replay();};GameManager.cpp#include <iostream>#include Hangman.h#include GameManager.hvoid GameManager::start_game(){    bool replay;    do    {        play_game();        replay = handle_replay();    }    while (replay);    std::cout << Alright, bye then! << std::endl;}void GameManager::play_game(){    hangman.init_game();    while (true)    {        print_game_state_info();        read_input_into_guess();        hangman.make_guess(guess);        handle_guess();        if (hangman.is_game_won())        {            handle_win();            break;        }        if (hangman.is_game_lost())        {            handle_lose();            break;        }    }}void GameManager::handle_guess(){    if (hangman.is_guess_correct() && hangman.is_game_won())    {        return;    }    else if (hangman.is_guess_correct())    {        std::cout << correct! << std::endl;    }    else    {        int numTries = hangman.get_number_of_tries();        std::cout << wrong! ( << numTries <<  tr << ((numTries == 1) ? y : ies) <<  left) << std::endl;    }}void GameManager::handle_win(){    std::cout << You win! << std::endl;    print_game_state_info();}void GameManager::handle_lose(){    std::cout << You lose! << std::endl;    std::cout << The word was  << hangman.get_word() << . << std::endl;}void GameManager::read_input_into_guess(){    std::cout << Guess a letter: ;    guess = reader.get_input_char();}void GameManager::print_game_state_info(){    std::cout << hangman.get_word_state_as_string();    if (hangman.right_guesses_exist())    {        std::cout <<     correct:  << hangman.get_right_guesses_as_string();    }    if (hangman.wrong_guesses_exist())    {        std::cout <<     wrong:  << hangman.get_wrong_guesses_as_string();    }    std::cout << std::endl;}bool GameManager::handle_replay(){    char promptAnswer;    bool replay;    std::cout << Play again? (Y/n) << std::endl;    try    {        promptAnswer = (char) toupper(reader.get_input_char());        replay = (promptAnswer != 'N');    }    catch (int e)    {        replay = true;    }    if (replay)    {        std::cout << std::endl << std::endl << std::endl;    }    return replay;}Hangman.h#pragma once#include <string>#include <set>#include WordChooser.hclass Hangman {public:    Hangman();    void init_game();    void make_guess(char c);    bool is_guess_correct();    std::string get_word();    std::string get_word_state_as_string();    std::string get_right_guesses_as_string();    std::string get_wrong_guesses_as_string();    bool right_guesses_exist();    bool wrong_guesses_exist();    int get_number_of_tries();    bool is_game_won();    bool is_game_lost();private:    const int MAX_GUESSES = 10;    const char PLACEHOLDER = '_';    WordChooser chooser;    std::string word;    char curGuess;    std::set<char> rightGuesses;    std::set<char> wrongGuesses;};Hangman.cpp#include Hangman.h#include <algorithm>Hangman::Hangman(){    init_game();    chooser.set_file(words.txt); // one word per line}void Hangman::init_game(){    rightGuesses.clear();    wrongGuesses.clear();    word = chooser.get_random_word();    for (unsigned int i = 0; i < word.length(); i++)    {        word[i] = (char) toupper(word[i]);    }}void Hangman::make_guess(char c){    curGuess = (char) toupper(c);    if (is_guess_correct())    {        rightGuesses.insert(curGuess);    }    else    {        wrongGuesses.insert(curGuess);    }}bool Hangman::is_guess_correct(){    return (word.find(curGuess) != std::string::npos);}std::string Hangman::get_word(){    return word;}std::string Hangman::get_word_state_as_string(){    std::string output = ;    char c;    for (unsigned int i = 0; i < word.length(); i++)    {        c = word[i];        if (std::find(rightGuesses.begin(), rightGuesses.end(), c) != rightGuesses.end()                || !isalpha(c))        {            output += c;        }        else        {            output += PLACEHOLDER;        }    }    return output;}std::string Hangman::get_right_guesses_as_string(){    std::string output = ;    for (auto &&guess : rightGuesses)    {        output += guess;    }    return output;}std::string Hangman::get_wrong_guesses_as_string(){    std::string output = ;    for (auto &&guess : wrongGuesses)    {        output += guess;    }    return output;}bool Hangman::right_guesses_exist(){    return !rightGuesses.empty();}bool Hangman::wrong_guesses_exist(){    return !wrongGuesses.empty();}int Hangman::get_number_of_tries(){    return MAX_GUESSES - wrongGuesses.size();}bool Hangman::is_game_won(){    char c;    for (unsigned int i = 0; i < word.length(); i++)    {        c = (char) toupper(word.at(i));        if (std::find(rightGuesses.begin(), rightGuesses.end(), c) == rightGuesses.end()                && isalpha(c))        {            return false;        }    }    return true;}bool Hangman::is_game_lost(){    return get_number_of_tries() == 0;}WordChooser.h#pragma once#include <string>#include <fstream>class WordChooser{public:    ~WordChooser();    void set_file(std::string filename);    std::string get_random_word();private:    std::ifstream file;};WordChooser.cpp#include WordChooser.h#include <stdlib.h>#include <time.h>WordChooser::~WordChooser(){    file.close();}void WordChooser::set_file(std::string filename){    file.open(filename.c_str());}std::string WordChooser::get_random_word(){    std::string output;    std::string line;    int n = 0;    srand (time(NULL));    while (!file.eof())    {        file >> line;        n++;        if (rand() % n == 0)        {            output = line;        }    }    file.seekg(0);    return output;}CharReader.h#pragma onceclass CharReader {public:    char get_input_char();};CharReader.cpp#include CharReader.h#include <iostream>char CharReader::get_input_char(){    std::string input;    std::cin >> input;    return (char) toupper(input.at(0));}CMakeLists.txt (why not?)cmake_minimum_required(VERSION 2.8.4)project(Hangman)set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++11)include_directories(header src)set(SOURCE_FILES src/main.cpp src/Hangman.cpp src/GameManager.cpp src/CharReader.cpp src/WordChooser.cpp)add_executable(Hangman ${SOURCE_FILES})And lastly, here's some sample output:____Guess a letter: ecorrect!_E__    correct: EGuess a letter: iwrong! (9 tries left)_E__    correct: E    wrong: IGuess a letter: nwrong! (8 tries left)_E__    correct: E    wrong: INGuess a letter: scorrect!_ES_    correct: ES    wrong: INGuess a letter: tYou win!TEST    correct: EST    wrong: INPlay again? (Y/n)nAlright, bye then!
Hangman on the C++ommand line
c++;object oriented;c++11;console;hangman