< Previous | Contents | Next >

For Loops, Strings, and Arrays: Word Jumble‌


You’ve seen how to work with single values, but in this chapter you’ll learn how to work with sequences of data. You’ll learn more about strings—objects for sequences of characters. You’ll also see how to work with sequences of any type. And you’ll discover a new type of loop that’s perfect for use with these sequences. Specifically, you’ll 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