Code from learning C++