# **[](https://en.cppreference.com/w/cpp/header/iostream)** provides `std::cin`, `std::cout`, `std::cerr`, `std::clog` for standard I/O. It's the C++ way to read from stdin and write to stdout/stderr. Use `std::cout` for normal output, `std::cerr` for errors, and `std::cin` for input. For formatted output, prefer `std::format` in C++20, but iostream is portable and widely used. ## Example This example reads a line from standard input and echoes it back, demonstrating basic stream input/output. ```cpp // compile: g++ -std=c++11 -o iostreamexample iostreamexample.cpp // run: ./iostreamexample // description: reading and printing with iostream #include #include int main() { std::cout << "enter your name: "; std::string name; std::getline(std::cin, name); std::cout << "hello, " << name << "!\n"; return 0; } ```