c++ code (2013 Spring)