Fancy C++ program