X-Git-Url: https://git.llucax.com/z.facultad/75.06/jacu.git/blobdiff_plain/36b1973b672029dbb51c14fdd3e99d485f326e0a..b7363b3e0c059ce04f5f2bfa913e06940915aa7c:/util/charstat.cpp diff --git a/util/charstat.cpp b/util/charstat.cpp index 369cffe..ba4631b 100644 --- a/util/charstat.cpp +++ b/util/charstat.cpp @@ -7,7 +7,7 @@ #include #include -typedef std::map< char, unsigned > freq_type; +typedef std::map< unsigned char, unsigned > freq_type; class print: public std::unary_function< freq_type::value_type, void > { @@ -23,17 +23,18 @@ public: os.width(4); os.fill(' '); if (isgraph(p.first)) { - os << p.first; - } else { - std::ostringstream oss; - oss << "0x"; - oss.width(2); - oss.fill('0'); - oss.setf(std::ios::hex, std::ios::basefield); - oss << int(p.first); - os << oss.str(); + os << p.first << " ["; } - os << " (" << double(p.second) / total * 100 << "%)\n"; + std::ostringstream oss; + oss << "0x"; + oss.width(2); + oss.fill('0'); + oss.setf(std::ios::hex, std::ios::basefield); + oss << int(p.first); + os << oss.str() << ":" << unsigned(p.first); + if (isgraph(p.first)) os << "]"; + os << " (" << double(p.second) / total * 100 << "% : " + << unsigned((double(p.second) / total) * 4294967296ull) << ")\n"; } };