< Previous | Contents | Next >

For Loops, Strings, and Arrays: Word Jumble


Youve seen how to work with single values, but in this chapter youll learn how to work with sequences of data. Youll learn more about stringsobjects for sequences of characters. Youll also see how to work with sequences of any type. And youll discover a new type of loop thats perfect for use with these sequences. Specifically, youll learn to:

n Use for loops to iterate over sequences

n Use objects, which combine data and functions

n Use string objects and their member functions to work with sequences of characters

n Use arrays to store, access, and manipulate sequences of any type

n Use multidimensional arrays to better represent certain collections of data


 

Using for LoopsIntroducing the Counter ProgramCounting with for LoopsUsing Empty Statements in for LoopsNesting for LoopsUnderstanding ObjectsUsing String ObjectsIntroducing the String Tester ProgramCreating string ObjectsConcatenating string ObjectsUsing the size() Member FunctionIndexing a string ObjectIterating through string ObjectsUsing the find() Member FunctionUsing the erase() Member FunctionUsing the empty() Member FunctionUsing ArraysIntroducing the Hero’s Inventory ProgramCreating ArraysIndexing ArraysAccessing Member Functions of an Array ElementBeing Aware of Array BoundsUnderstanding C-Style StringsUsing Multidimensional ArraysIntroducing the Tic-Tac-Toe Board ProgramCreating Multidimensional ArraysIndexing Multidimensional ArraysIntroducing Word JumbleSetting Up the ProgramPicking a Word to JumbleJumbling the WordWelcoming the PlayerEntering the Game LoopSaying GoodbyeSummaryQuestions and AnswersDiscussion QuestionsExercises