bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Tutorial
C++•C++ Tutorial

C++ String Namespace

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ String Namespace?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

#___ <iostream>
3Order

Put the learning moves in the order that makes the concept easiest to apply.

It is up to you if you want to include the standard namespace library or not.
You might see some C++ programs that run without the standard namespace library.
Omitting Namespace

Omitting Namespace

You might see some C++ programs that run without the standard namespace library. The using namespace std line can be omitted and replaced with the std keyword, followed by the :: operator for string (and cout ) objects:

Example

#include <iostream>
#include <string>
// using namespace std; - Remove this line int main() { std:: string greeting = "Hello"; std:: cout << greeting;
return 0;
}

It is up to you if you want to include the standard namespace library or not.

In our tutorial, we will continue to include the library.

Previous

C++ User Input Strings

Next

C++ C-Style Strings