Learn
Practice
Newsletter
Resources
Resume
New
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
Input & Output (cin, cout, cerr)
Last Updated: May 22, 2026
Medium Priority
11 min read
Get Premium
Subscribe to unlock full access to all premium content
Subscribe Now
Reading Progress
0%
On this page
The Four Standard Streams
Output with std::cout and <<
std::endl vs '\n'
Input with std::cin and >>
Reading Whole Lines with std::getline
The Classic >> Then getline Bug
Reading Different Types
Stream State: good, fail, bad, eof
Recovering from Bad Input
Writing Errors with std::cerr and std::clog
Formatting with <iomanip>
std::flush and Output Buffering
A Quick Word on using namespace std;
sync_with_stdio for Competitive Programming
A Complete E-Commerce Example
Vote/Request Content
Aa
Notes
Star
Complete
Ask AI
Operators
Notes
Star
Complete
Ask AI
Comments