< Previous | Contents | Next >

Setting Up the Program

First I create some initial comments, include two necessary files, and write a few

using directives.

// Lost Fortune

// A personalized adventure


#include <iostream> #include <string>

Introducing Lost Fortune 33

using std::cout; using std::cin; using std::endl; using std::string;


image

Figure 1.9‌

The story incorporates details provided by the player.


I include the file string, part of the standard library, so I can use a string object to access a string through a variable. There’s a lot more to string objects, but I’m going to keep you in suspense. You’ll learn more about them in Chapter 3, “For Loops, Strings, and Arrays: Word Jumble.”

Also, I employ using directives to spell out the objects in the std namespace that I plan to access. As a result, you can clearly see that string is in namespace std.