programming-examples/c++/Others/A simple output manipulator sethex.cpp
2019-11-15 12:59:38 +01:00

21 lines
312 B
C++

A simple output manipulator: sethex
#include <iostream>
#include <iomanip>
using namespace std;
ostream &sethex(ostream &stream)
{
stream.setf(ios::showbase);
stream.setf(ios::hex, ios::basefield);
return stream;
}
int main()
{
cout << 256 << " " << sethex << 256;
return 0;
}