Writing the code for a command in C++