updated print function for c++