The program should accept the input, find to see if it is in the word, then replace the null character _ with the correct letter.
char Guess[15];
guess looks like this, depending on word size
_ _ _ _ _
void hangman::guessed()
{
char Letter;
int Correct=0;
tochar = ui->lineEdit->text();
char *letter = foo.data();
Letter = *letter;
// Loop through the word
for(Subscript = 0; Subscript < Size; Subscript++)
{
//if the guess is good tell the user and update Guess
if(copy.at(Subscript) == Letter)
{
Guess[Subscript] = Letter;
Correct = 1;
ui->textBox->append(Guess);
void hangman::guessed()
{
char Letter;
int Correct=0;
QString tochar;
tochar = ui->lineEdit->text();
QByteArray foo = tochar.toLatin1();
char *letter = foo.data();
Letter = *letter;
// Loop through the word
for(Subscript = 0; Subscript < Size; Subscript++)
{
//if the guess is good tell the user and update Guess
if(copy.at(Subscript) == Letter)
{
Guess[Subscript] = Letter;
Correct = 1;
ui->textBox->append(Guess);
To copy to clipboard, switch view to plain text mode
instead of proper output like, _ _ e _ _
the textbox gets this appended to it.
ð*º
ð*º
e*º
ð*º`è_¸Ñ¦««««««««îþîþ
I feel as though its clearly a failed data conversion, I just do not know what to attempt next.
Bookmarks