Updated C++ prob1