Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) GetEmail

 

GetEmail is a function to obtain my email address.

 

#include <cassert>
#include <string>
#include <vector>
#include <boost/foreach.hpp>

///GetEmail is a function to get Bilderbikkel's email address
///From http://www.richelbilderbeek.nl/CppGetEmail.htm
const std::string GetEmail()
{
  assert(sizeof(int)==4); //32 bit, need 5 bit per char
  std::vector<int> v;
  v.push_back(373524753);
  v.push_back(574729473);
  v.push_back(201658497);
  v.push_back( 67477516);
  v.push_back(      398);
  std::string s;
  BOOST_FOREACH(int i,v)
  {
    for (int j=0; j!=6; ++j)
    {
      s.push_back(static_cast<char>((i % 32) + 97));
      i >>= 5;
    }
  }
  s[16] = '@';
  s[22] = '.';
  s.resize(s.size() - 4);
  return s;
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict