Question
Could anyone help elaborate on these two changes we need to make on the Word Jumble. I am not sure what is meant to "Initially accept the words and hint and store them into the array". Does it mean to add new words in?Also, What does "Save out" mean. 1. Initially accept the words and hint and store them into the array. (cin/getline) 2. Save out any word/hints that were added. Read them back in (ask for additions if array not full). Please don't do the work for me, I just need to conseptually know what these question mean and how to begin it. Thank you very much! Here is the original code that needs to be manipulated with statement 1 & 2 // Word Jumble // The classic word jumble game where the player can ask for a hint #include #include #include #include using namespace std; int main() { enum fields {WORD, HINT, NUM_FIELDS}; const int NUM_WORDS = 5; const string WORDS[NUM_WORDS][NUM_FIELDS] = { {"wall", "Do you feel you're banging your head against something?"}, {"glasses", "These might help you see the answer."}, {"labored", "Going slowly, is it?"}, {"persistent", "Keep at it."}, {"jumble", "It's what the game is all about."} }; srand(static_cast(time(0))); int choice = (rand() % NUM_WORDS); string theWord = WORDS[choice][WORD]; // word to guess string theHint = WORDS[choice][HINT]; // hint for word string jumble = theWord; // jumbled version of word int length = jumble.size(); for (int i=0; i<< " Welcome to Word Jumble! "; cout << "Unscramble the letters to make a word. "; cout << "Enter 'hint' for a hint. "; cout << "Enter 'quit' to quit the game. "; cout << "The jumble is: " << jumble; string guess; cout << " Your guess: "; cin >> guess; while ((guess != theWord) && (guess != "quit")) { if (guess == "hint") { cout << theHint; } else { cout << "Sorry, that's not it."; } cout <<" Your guess: "; cin >> guess; } if (guess == theWord) { cout << " That's it! You guessed it! "; } cout << " Thanks for playing. "; return 0; }
Explanation / Answer
//Word Jumble //The classic word jumble game where the player can ask for a hint. Also can //select difficulties: Easy, Normal, or Hard. #include #include #include #include using namespace std; int main() { enum fields {WORDS, HINT, NUM_FIELDS}; enum difficulty {EASY, NORMAL, HARD}; const int NUM_WORDS = 5; cout