basic practice problem of c++