Practice problem in C++