Flash cards
Review the key moves
What is the main idea behind C++ String Data Types?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
Which statement best captures the main point of this lesson?
Complete the missing token from the example code.
___ greeting = "Hello";Put the learning moves in the order that makes the concept easiest to apply.
String Types
The string type is used to store a sequence of characters (text). This is not a built-in type, but it behaves like one in its most basic usage. String values must be surrounded by double quotes:
Example
string greeting = "Hello";
cout << greeting;To use strings, you must include an additional header file in the source code, the <string> library:
Example
// Include the string library #include <string> // Create a string variable string greeting = "Hello"; // Output string value cout << greeting;You will learn much more about strings in our C++ Strings Chapter .