From a818b9af6697df7b65b42d6ab450e540f7b50518 Mon Sep 17 00:00:00 2001 From: Robin Dietzel Date: Thu, 9 Nov 2023 20:23:10 +0100 Subject: [PATCH] Add pure random generator --- task1/src/task1-randgen.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/task1/src/task1-randgen.cpp b/task1/src/task1-randgen.cpp index 6e3d9cc..3f7fc20 100644 --- a/task1/src/task1-randgen.cpp +++ b/task1/src/task1-randgen.cpp @@ -25,8 +25,18 @@ int main(int argc, char *argv[]) { parser.process(app); const QStringList args = parser.positionalArguments(); + + if(args.length() != 2) { + parser.showHelp(-1); + } + const QString dest = args.at(0); - const int pow_value = args.at(1).toInt(); + bool convOK; + const int pow_value = args.at(1).toInt(&convOK); + if(!convOK) { + parser.showHelp(-1); + } + const int num_values = std::pow(10, pow_value); QTextStream print(stdout);