Problem 6 C++