C++ TutorialLesson 11Free preview
C++ Strings
This lesson is part of C++ · All levels
Summary
This lesson discusses the handling of text in C++ through the class std::string of the header string. You learn to make strings, combine them, and figure out the length and content of a string. Strings are very important because almost all programs process text data such as names, addresses, and messages.
Key points
- String is created by including <string> and then declaring std::string name="...";
- Two strings can be combined with the + operator or the append() function.
- Length() or size() returns the number of characters in the string.
- Access per character can be done with an index starting at 0.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.