0

can you explain how to chack all the char inside the array without check only the first and it says equal

for(j=0;j<len;j++)
            {
                if (letter==copywords[j])
                {
                    //words[j]=copywords[j];
                    words[j]=letter;
                    cout << "good guess: " << words[j] << endl;   //correct
                }
                else if(words[j]==copywords[j])) /problem
                {   
                    cout << "done!!!" << endl;
                    system ("pause");
                    exit(0);
                }
                else if(!letter) //here don' t go to else
                {
                    count++;
                    hangman(count);
                }
            }

Edited by diafol: Moved to C++ and applied code tags

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by zeroliken
0

can you explain how to chack all the char inside the array without check only the first and it says equal

use a counter or a boolean, if one of the letters is not equal return false or change the value of the counter, and later use that boolean or counter for a specific task like printing equal or not

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.