Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is my code so far for homework in C++ I keep getting an error saying my identifier can't be found. I've tried int inside

This is my code so far for homework in C++ I keep getting an error saying my identifier can't be found. I've tried int inside the brackets and before the variable and it doesn't seem to work.

#include #include

using namespace std;

string getWord(int pos); int getGameNumber(); char getGuess();

int main() { //Declare variables int level = 0; int gameNum; int guess; int wLength; int counter = 0; string word;

//Getting initial inputs from user gameNum = getGameNumber(); word = getWord(gameNum); wLength = word.length();

//Drawing hangman figure drawHangman(level);

while (true) { guess = getGuess(); if (guess == word[counter]) { counter++; } else { level++; } //Draw next level hangman figure drawHangman(level); //User lose if (level == 6) { cout

cout > word; } myFile >> word; myFile.close(); return word; } //Input game number int getGameNumber() { int gameNum; cout > gameNum; return gameNum; } //Input guess char getGuess() { char guess; cout > guess; return guess; }

image text in transcribed

image text in transcribed

(Global Scope) - main() Hangman.cpp + x C2334_Ch06_Hmwk1_Hangman 20 //Getting initial inputs from user 21 gameNum getGameNumber(); 22 word = getWord( gameNum); 23 wLength = word. length(); 24 1 //Drawing hangman figure drawHangman(level); while (true) 25 26 27 28 29 30 31 32 33 guess - getGuess(); if (guess == word[counter]) { counter++; 34 35 36 37 38 39 40 41 42 43 44 45 100% else { level++; } //Draw next level hangman figure drawilangman(level); // User lose if (level == 6) { cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions