1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
   | void AfficheChiffreHexadecimal(unsigned int c)
{
   assert(c < 16);
   std::cout << "0123456789ABCDEF"[c];
}
 
bool AfficheDeuxChiffresHexadecimaux(unsigned int c, bool initial, bool final)
{
   int premier = (c /16) % 16;
   int second = c % 16;
   if (!inital || premier != 0) {
      AfficheChiffreHexadecimal(premier);
      initial = false;
   }
   if (!initial || final || second != 0) {
      AfficheChiffreHexadecimal(second);
      initial = false;
   }
   return initial;
}
 
bool AfficheQuatreChiffresHexadecimaux(unsigned int, bool initial, bool final)
{
   int premier = (c/256) % 256;
   int second = c % 256;
   initial = AfficheDeuxChiffresHexadecimaux(premier, initial, false);
   initial = AfficheDeuxChiffresHexadecimaux(second, initial, final);
   return initial;
}
 
void AfficheHuitChiffresHexadecimaux(unsigned int, bool initial)
{
   int premier = (c/65536) % 65536;
   int second = c % 65536;
   initial = AfficheQuatreChiffresHexadecimaux(premier, initial, false);
   initial = AfficheQuatreChiffresHexadecimaux(second, initial, true);
} | 
Partager