1What to include for cin and cout
<iostream>
2What does cin.clear() do?
Sets a new value for the stream's internal error state flags.
The current value of the flags is overwritten: All bits are replaced by those in state; If state is goodbit (which is zero) all error flags are cleared.
3What does cin.ignore() do?
Extracts characters from the input sequence and discards them, until either n characters have been extracted, or one compares equal to delim.
4What does wrapping cin in an if statement do?
In C++, stream classes implement operator bool() which allows them to be implicitly converted to a boolean. This boolean indicates whether the streams are in a good or bad state.
6%x or %X
Hex and Hex uppercase
9%E
Scientific notation uppercase
13%n
stores the number of characters at a pointer in a signed int
15flag +
shows sign of numbers
16flag #
Shows 0x or 0X before hex values and forces decimal point on numbers
17flag 0
Left pads with zeros instead of spaces
18printf usage
%[flags][width][.precision]specifier
19width *
width is stored in variable section
20I/O manipulators included in <iostream>
endl, fixed, showpoint
21I/O Manipulators in <iomanip>
setw(), setprecision(), scientific, hex, dec, setfill(' '), left, right
22The only io manipulaitor that is not persistent
setw()
23How to check if cin failed
if (!cin)
24How to put cin back to normal after error
cin.clear() - clears error messages
25How to remove bad input from cin and what do you include
cin.ignore(numeric_limits<streamsize>::max(), '\n'), #include <limits>
26Condition for s while loop that exits on good input
!cin.good()
27how to use scanf?
scanf("%[flags][width][.precision]specifier", specifier_data_type)
28what to include for scanf and printf?
#include <cstdio.h>