code from c++ programming class