I'm developing a videogame themed hangman game right now for class and I was wondering how to put spaces in the word they were supposed to guess without making it where the player has to input a space (Makes the game impossible to win by the way.)
EX.
string SecretWord;
int R = rand()%10+1;
if (R == 1) SecretWord = "grand theft auto";
if (R == 2) SecretWord = "heavenly sword";
if (R == 3) SecretWord = "rock band";
if (R == 4) SecretWord = "the orange box";
if (R == 5) SecretWord = "crackdown";
if (R == 6) SecretWord = "god of war";
if (R == 7) SecretWord = "guitar hero";
if (R == 8) SecretWord = "halo";
if (R == 9) SecretWord = "world of warcraft";
if (R == 10) SecretWord = "knights of the old republic";
This is what results. Never ends. (The period represents a blank space where there is supposed to be a letter. The period is where a space would be.
You have guessed ghieavnlysword
Word to guess heavenly.sword
Enter a Letter:
Thanks for helping a newb.