Solution for problem 27

Added solution for Problem 27 in C++