Comparing user input to array characters
-
I have an array of letters which’s makes a word and I was wondering how I could compare a user’s input letter against the letters in the array so when running it would display something like this Example ** Word to be guessed in array – train ** User inputs letter a Displays _ _ a_ _ User inputs letter n Displays _ _ a _ n User inputs letter t Displays t _ a _ n And so on until the word is complete. If some1 could provide an example I could follow id be most grateful as I purchased a book a few days ago on c# programming and this is one of the tasks it doesn’t really give much info on how to do it. i know it uses a loop to move along and check each character but im not sure on this. thanks :)
-
I have an array of letters which’s makes a word and I was wondering how I could compare a user’s input letter against the letters in the array so when running it would display something like this Example ** Word to be guessed in array – train ** User inputs letter a Displays _ _ a_ _ User inputs letter n Displays _ _ a _ n User inputs letter t Displays t _ a _ n And so on until the word is complete. If some1 could provide an example I could follow id be most grateful as I purchased a book a few days ago on c# programming and this is one of the tasks it doesn’t really give much info on how to do it. i know it uses a loop to move along and check each character but im not sure on this. thanks :)
sound like hangman:rolleyes:
Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software. [^]
-
I have an array of letters which’s makes a word and I was wondering how I could compare a user’s input letter against the letters in the array so when running it would display something like this Example ** Word to be guessed in array – train ** User inputs letter a Displays _ _ a_ _ User inputs letter n Displays _ _ a _ n User inputs letter t Displays t _ a _ n And so on until the word is complete. If some1 could provide an example I could follow id be most grateful as I purchased a book a few days ago on c# programming and this is one of the tasks it doesn’t really give much info on how to do it. i know it uses a loop to move along and check each character but im not sure on this. thanks :)
-
I have an array of letters which’s makes a word and I was wondering how I could compare a user’s input letter against the letters in the array so when running it would display something like this Example ** Word to be guessed in array – train ** User inputs letter a Displays _ _ a_ _ User inputs letter n Displays _ _ a _ n User inputs letter t Displays t _ a _ n And so on until the word is complete. If some1 could provide an example I could follow id be most grateful as I purchased a book a few days ago on c# programming and this is one of the tasks it doesn’t really give much info on how to do it. i know it uses a loop to move along and check each character but im not sure on this. thanks :)
neptune2k wrote:
I purchased a book a few days ago on c# programming
It is a common misconception that learning to program is "equal" to learning a programming language. Evidence of it abounds here in these forums. Anyway, you need a book on Programming Logic and Design[^].
led mike