Hello, I am trying to create a hangman type game. The word to be guessed is going to be picked from a text doc, and the user inputs a string (either a single char or an entire word). I have been thinking of ways to handle everything, and I think I am going to need to check the word with the user input. I was thinking of using pointers to move through each of the strings and compare them. But I cant seem to figure out how to create a string pointer to the strings. I keep getting a type conversion error when i try, could someone please tell me if this is possible. And also, if it is possible is it a good way of doing this. I know there is a compare function in the stl, but was wanting to try and create it mostly without the use of stl methods.
you don't need any pointers for this. you could do it that way, but you do not need them.
we can show you what to do where you tried, show us what did not work if you want.
all you really need is
for each letter in the input
for each letter in the string
does it match? if yes, do something, else hang the sucker
string[int] is one character
string.cstr() or c_str() whatever it is (auto complete makes me lazy) gives a char*, but its constant so its about useless for most purposes.
&stringvar gives a usable char*, but you really need to be careful if you do that and I do not advise it.