C++20 sections · 1024 units
Open in Course

The using namespace std Line

Avoiding std:: prefix

The line using namespace std; lets you write cout instead of std::cout. Standard library features live in a namespace called std. Without this line, you must type std:: before every standard feature.

Try changing cout to std::cout after removing the using line. The program still works. The using namespace std; line just makes code shorter. Namespaces prevent naming collisions.

If two libraries both define cout, prefixes like std:: clarify which one you mean.