Good day everyone!
I would like to ask some problem about the program I am currently working (hangman to be specific). Since I am just a beginner, there are many things I would like to clarify. I would like to ask your help so that I can enable more to see what are my errors in my code. It is too many to ask. Please bear with me and sorry for the inconvenience.
1. I do have 4 categories (three rounds). The user will choose a category. For every round, a different category. You cannot choose the same category in different rounds. After choosing a category, the game will provide a random word. At this moment, i have done only the random part (and it might some errors too.)
2. I am also having difficulty in underscores and spaces. You see, I only guessed that part. I do not know if that will work (or maybe it will destroy my whole program.)
3. Will you give me some advices on how to check inputs and how to display the letters which are used already for a specific round? I am not merely asking for code (though it will be gladly accepted it) but some detailed explanations.
4.I am having difficulty with this code.Code:int inputerror(char b, char* h)
{
int i;
char alpha[27];
strcpy(alpha, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
// change letters used from the alphabet to '_'
for (i = 0; alpha[i] != '\0'; i++)
{
if ((alpha[i]) == h)
{
alpha[i] = '_';
}
}
// pad with spaces so it appears in the middle of the screen
printf(" ");
for (i = 0; alpha[i] != '\0'; i++)
printf("%c ", alpha[i]);
printf("\n\n");
}
a. under what library(i.e stdio, stdlib) is strlwr, tolower and _tolower? do you think it requires in my code?
b. Is this code ok?
Here are just some of my questions. Please see the attached file below for the whole code. If you see other errors, please tell me. I really need your advices regarding with this case. Hope that you can help me as soon as possible.
Thanks in advance!