Convert slideshw.c to C++