ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 2 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 12 May 2017 My Price 9.00

Week 4 Project – Hangman Game

This is a hangman game that is supposed to pull words from a text file. There is a project file with the instructions. I have already commented out what each line should do in the cpp file

Week 4 Project – Hangman Game – 100 pointsDescriptonThe poin± of ±his projec± is ±o pu± ±oge±her several of ±he concep±s ±ha± we have been practcing.We will be implementng functons, random numbers, reading from and writng ±o Fles, looping,ge²ng inpu± from user and validatng ±ha± inpu±, displaying informaton ±o ±he user, using if/elseif s±a±emen±s, and becoming more familiar wi±h Visual S±udio.Hangman is a game where ±he user is presen±ed wi±h a word ±ha± has a speciFc number ofle³ers.The user can± see ±he le³ers and is asked ±o make guesses untl ei±her ±hey run ou± ofguesses or ±hey guess ±he word correc±ly.´or our projec± we will be implementng ±he basic concep±s of ±he game by presentng ±he userwi±h a word ±ha± con±ains all as±erisk, ±ell ±hem how many guesses ±hey have leµ, allow ±hem ±oen±er a guess, and if ±hey guessed a le³er ±ha± IS in ±he word, redisplay ±he word wi±h ±hecorrec± le³ers shown while all o±her will stll be as±erisk.Requiremen±s1)User will be presen±ed wi±h a Main Menu ±ha± will look like ±he following(making sure±ha± ±hey can only en±er ±he available optons, or ±he main menu jus± redisplays i±self)2)If user selec±s ±o play hangmana.Genera±e a random number be±ween 0 and 19b.Keep Reading ±he HangmanWords.±x± Fle untl you ge± ±o ±he n±h word(nrepresen±s ±he random number ±ha± was genera±ed)c.Display ±he game boardd.Ge± ±he users guesse.Valida±e ±he inpu± ±o make sure i± is a le³er(keep in mind i± should workregardless of upper or lower case le³ers)

televisioninternetcomputerrocketjupitersalmonapplausecognitivecollaboratecommissionembellishenhancementeventuallyfacilitatehereditaryinalienableinnovativemethodologyomnipotentperception

#include <iostream>#include <string>#include <cstdlib>#include <time.h>#include <fstream>#include <cctype>using namespace std;void runGame();string displayMainMenu();string readRandomWord();void displayGameBoard();void writeScoreToFile();void displayScoreToPlayer();int numGuessesLeft = 10;bool userWon = false;//flag to keep track of if player has wonstring userGuess;//variable to hold the users guessstring word;//variable to hold the random word that wasread from the filestring asteriskWord = "";//variable to hold asterisks for each letter ofthe original word and initializes it to an empty stringstring fileName = "";//filename that will be used to read the word fromthe file and initializes it to an empty stringstring menuSelection = "";//variable to hold the players choice on the mainmenu and initializes it to an empty stringint bestscore = 0;//variable to hold the players best score sofar (calculated by numGuessesLeft * lengthOfWord)int bestNumGuessesLeft;//variable to hold numOfGuesses for best score sofarstring bestscoreword;//variable to hold the word for the best score sofarstring input = ""//variable to hold main menu selection andinitializes it to an empty stringint main(){//kick off the gamereturn 0;}void runGame() {//get user selection from the main menu//keep looping until they press x or X//reset variables for start of a new gameasteriskWord = "";userWon = false;numGuessesLeft = 10;//get the random word from the file//fill in the asterisk word with all asteriks(hint:a loop might behelpful)//keep displaying game board in a loop until either they are out of

Attachments:

Answers

(11)
Status NEW Posted 12 May 2017 03:05 AM My Price 9.00

-----------

Attachments

file 1494559241-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)