Character Analogy Flashcards
Character Flashcards for Memorizing Concepts
(Perfect for quick recall or spaced repetition.)
🎴 FLASHCARD 1 — Cin (Input Stream)
Role: Delivery kid who brings information into Streamville
Superpowers:
Skips whitespace
Extracts only what type you asked for
Weaknesses:Panics on wrong data (failbit)
Keeps leftovers in backpack unless cleaned
🎴 FLASHCARD 2 — Cout (Output Stream)
Role: Town Crier
Superpowers:
Announces whatever you give him
Flushes on endl
Weaknesses:Doesn’t flush for '\n' unless told
🎴 FLASHCARD 3 — Buffer
Role: Magical backpack shared by Cin/Cout
Superpowers:
Temporarily stores info
Flushes automatically or manually
Weaknesses:Can cause confusing behavior if misunderstood
🎴 FLASHCARD 4 — Doctor Clear
Role: Fixes error states
Superpowers:
Resets failbit and other panic states
Use when:Input fails (e.g., reading "abc" as a number)
🎴 FLASHCARD 5 — Broom Ignore
Role: Sweeps away leftover input
Command: cin.ignore(max, '\n')
Purpose:
Discard everything Cin didn’t deliver yet
🎴 FLASHCARD 6 — Error Trio
Failbit: Panics on wrong types
Eofbit: Falls asleep at end-of-file
Badbit: Indicates severe corruption
🎴 FLASHCARD 7 — Sir Format (iomanip manipulators)
Tools:
setw
left/right
fixed
setprecision
showpoint
Purpose:Makes output beautiful and aligned
🎴 FLASHCARD 8 — FileStream Portals
ifstream: read
ofstream: write
fstream: both
ios::out: erase notebook
ios::app: add to the end
🎴 FLASHCARD 9 — Sister Delimita
Role: Queen of tab-delimited, CSV, table-based data
Tools:
Tabs → natural for >>
Commas → require getline
🎴 FLASHCARD 10 — Professor Stringstream
Role: Handles messy data like a pro
Superpowers:
Uses str() to replace internal data
Uses clear() to reset failures
Safely extracts values from chaotic lines