It has a small undetectable BUG
When I enter a letter to guess the word it should not give me
"wrong guess" when that letter is inside the word. for example
when i enter "f" for facebook it works correctly BUT it
prints "wrong guess" which it shoudn't....THANKING YOU a million times
for the help
PS: This is just one instance of the program soo don't worry about the
rest of the coding, i just need help in this step.
#include "conio.h"
#include "stdio.h"
#include "string.h"
void main()
{
clrscr();
char word[25]= "facebook";
char guess;
int i;
int blank=0;
int word_length = strlen(word);
printf("%s\n",word);
while(blank<word_length)
{
printf("\x7f"); /*prints an ASCII character*/
blank++;
}
printf("\n\nenter a character to guess ");
scanf("%c",&guess);
for(i=0;i<word_length;i++)
{
if(word[i]==guess)
{
gotoxy(i+1,2);
printf("%c",guess);
}
else if(word[i] != guess)
{
gotoxy(1,7);
printf("wrong guess");
}
}
getch();
}

New Topic/Question
Reply




MultiQuote






|