27 November 2012

not since college…

i found myself messing around with c++ today. it was my favorite language in college…20 years ago. had to refresh a big chunk of my memory (and google for a bit) in order to get this simple updated “hello, world” program compiled and running.

// ohaiwurld.cpp
#include <iostream>
#include <stdio.h>

int main(int argc, char* argv[])
  printf("o hai, wurld!\n");
  if (argc > 1)
     printf("we haz argumentz!\n");
     printf("argz = ");
     for (int i = 1; i < argc; i++)
        printf("%s ", argv[i]);
  return 0;

$ g++ ohaiwurld.cpp -o ohaiwurld
$ ./ohaiwurld lolcatz cheezburger can haz
o hai, wurld!
we haz argumentz!
argz = lolcatz cheezburger can haz

never thought i’d be messing with this. i don’t know if it will be part of a solution i’m looking into at work, but it was a neat moment to step back into this.