All in C++ and with input-checking