Solutions of some problems in C++