sample.cpp runnig without faults - need to check logical correctness