/****************************************************************************** * This program prints a message over and over. * Takes arguments from the command line. * First argument is number of times to print. * Second argument is the message to print (use double quotes) * * Copyright © 2020 Richard Lesh. All rights reserved. *****************************************************************************/ #undef NDEBUG #include "Utils.hpp" #include #include #include using namespace Utils; using namespace std; static int const REPEATS = 100; static string const MESSAGE = "Chalk is not food!"; int main(int argc, char **argv) { if (argc != 3) { cout << fmt::format("Syntax: {0:s} count message", argv[0]) << endl; exit(1); } int const REPEATS = Utils::stoiWithDefault(string(argv[1]), REPEATS); string message = MESSAGE; if (string(argv[2]).length() > 0) { message = string(argv[2]); } for (int x = 0; x < REPEATS; ++x) { cout << message << endl; } return 0; }