Word guessing.
Ask the person to enter in a word. The word must be 4 letters long, but
doesn't have to be a valid English word. Test the length of the word,
and make sure all the characters are letters. Convert all the letters
to lowercase. If they make a mistake, ask them to enter the word again.
You program will try to mix letters together to try to figure out which
word they entered.
Write a program try all the combinations of letters until the
program matches the correct word.
You will need a while loop, and nested for loops to solve this problem.
The program will need to check the guess to the actual word to see if
it is correct. Once the program guesses the word, display the match.
For example, you can assume the word is 4 letters long. If you like,
you can see how the program can guess a word that could be 1,2,3 or 4
letters long. However to make the program simple, 4 letters are needed.
Start by looking to see if the word is: aaaa
Then see if the word is aaab
After a while, you will be at aaaz
next try aaba etc till you
are at aazz then try abaa,
etc.
Keep going through all the letters until the program has made a match.
It's like you are counting digits, but using letters instead. Such as 0099 would roll over to become 0100, if you were dealing with
numbers. However for your program is a word that has only letters.
Remember to use a char
variable. You can check letters by doing 'a' and 'z' to set your loop
to go from the characters a to z.