Display which format flags are currently set e.g. fixed, scientific, dec, hex
std::ostream& operator<<(std::ostream& s, const std::ios::fmtflags f) {
if(f & std::ios::boolalpha) s << "boolalpha ";
if(f & std::ios::dec) s << "dec ";
if(f & std::ios::hex) s << "hex ";
if(f & std::ios::oct) s << "oct ";
if(f & std::ios::fixed) s << "fixed ";
if(f & std::ios::scientific) s << "scientific ";
if(f & std::ios::right) s << "right ";
if(f & std::ios::left) s << "left ";
if(f & std::ios::internal) s << "internal ";
if(f & std::ios::showbase) s << "showbase ";
if(f & std::ios::showpoint) s << "showpoint ";
if(f & std::ios::showpos) s << "showpos ";
if(f & std::ios::uppercase) s << "uppercase ";
if(f & std::ios::unitbuf) s << "unitbuf ";
if(f & std::ios::skipws) s << "skipws ";
return s;
}
std::cout << std::cout.flags() << "\n";
Example output
dec fixed skipws
https://en.cppreference.com/w/cpp/io/ios_base/flags