void EnterWord()
{
char solution[20]; //holds solution
char blank[20]; //holds "*"'s for unsolved letters
int Subscript=0;
int State=1;
char Guess[20];
char Copy [20];
char Letter;
int Correct =0 ;
// input the string and getline it
cout<<"Enter phrase 20 chars or less."<<endl;
cin.getline(solution, 20);
int Word; // this will hold the subscript of our word
int Size; // this will hold the length of our word int State = 1 ; // This will hold the game state. int Subscript= 0; // This will hold the subscirpt char Guess [MAX_WORD_SIZE]; // this will hold their current word char Copy [MAX_WORD_SIZE]// this will hold a copy of word
char letter;// this will be their letter guess int Correct = 0 ; // This is a true/ false value
//Create a null terminated string to represent the word as the player know it//
for ( ; Subscript < Size; Subscript++)
{
Guess [Subscript] = '-';
}
// insert the null character
Guess [Subscript] = '\0';
// Go until the player is hung
while (State!=6)
{
DrawGallows(State);
cout << Guess << endl;
cout << "Guess a letter:" ;
cin >> letter;
// use only lower case letters
Letter = tolower(Letter);
for (Subscript = 0 ; Subscript < Size; Subscript ++ )
{
if (Copy[Subscript]== Letter)
{
Guess [Subscript] = Letter;
Correct =1 ;
cout<< endl<< "Good Guess";
// If guess equals the word they won so exit
if (strcmp (Words[Word],Guess) == 0 )
{
cout << endl << "Congratulation !! You won !!" << endl;
return;
}
}
}
// If they did not guess correctly
if (Correct == 0)
{
cout<< endl << "Sorry,bad guess!";
State++;
}
Correct = 0 ;
}
DrawGallows(State); // Draw the gallows at end of game
cout << "the word was : " << Words [Word]<< endl << endl;
}
can you help me correct this code, I am confused, because when I enter the input to run this function, it announce the window error? not the normal C++ error ?