Simple I/O Manipulators
unsigned long y;
std::cout << std::hex << y; // output y in hex notation
Implementations
namespace std {
// overload of operator <<() -- done in iostream library
ostream& operator << (ostream& s, ios_base& F(ios_base&))
// signature of a function - "function pointer"
{
return F(s);
}
// the manipulator function - clears basefield, then sets hex
ios_base& hex (ios_base& s)
{
s.setf(ios_base::hex, ios_base::basefield);
return s;
}
}