C++ version of bernv3

C++ version of bernv3