Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Programming Jokes

Name: Anonymous 2007-06-07 6:41 ID:nmbUVY+e

Post some of your good programming jokes here!
A good one I know is:
"My other car is a cdr" as in car and cdr from LISP

Also,
Why do programmers always confuse christmas and halloween?
Because oct[31] = dec[25]

Name: Anonymous 2007-06-07 12:55 ID:tyfBpoS6

>>1


#include <assert.h>

class BaseConverter {
  int m_base;

public:
  BaseConverter(const int base) : m_base(base) { return; }

  unsigned int operator[](int n) const {
    unsigned int val = 0;
    unsigned int s = 1;

    while(n) {
      val += s*(n%10);
      s *= m_base;
      n /= 10;
    }

    return val;
  }
};

int main(int, char**) {
  BaseConverter dec(10);
  BaseConverter oct(8);

  assert(oct[31] == dec[25]);

  return 0;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List