SMS exercise written in standard c++