diff --git a/c++/countdwon.cpp b/c++/countdwon.cpp new file mode 100644 index 0000000..7d23013 --- /dev/null +++ b/c++/countdwon.cpp @@ -0,0 +1,30 @@ +#include +#include + +unsigned short countdown(unsigned short num) +{ + if(!num) + { + std::cout << num << std::endl; + return countdown(num--); + } + else + { + std::cerr << "Boooom" << std::endl; + exit(-1); + } +} + +int main(int argc, char const *argv[]) +{ + if(argc == 2) + { + countdown(static_castargv[1]); + return EXIT_SUCCESS; + } + else + { + std::cerr << "usage: countdown [NUM]" << std::endl; + return EXIT_FAILURE; + } +}