]> git.llucax.com Git - z.facultad/75.06/jacu.git/blobdiff - util/charstat.cpp
Agrego el Mitico y Enigmatico Word Scaping al block sorting. Para usarlo usar parame...
[z.facultad/75.06/jacu.git] / util / charstat.cpp
index 369cffe417b464cb4c9b42c6e7b529bcb5b66d49..ba4631b8ae001eecfacef9fef4c1d3203f8425cd 100644 (file)
@@ -7,7 +7,7 @@
 #include <clocale>
 #include <cstdlib>
 
-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";
        }
 };