Convert prompts2.c to C++