From a522aae2611f4c5a4167b760a8ee835d5085213d Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Thu, 29 Oct 2020 22:39:02 +0900 Subject: [PATCH] Some quality-of-life fixes, improvements --- src/main.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f9b9695..981c5ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,6 +6,7 @@ #include #include #include +#include const char8_t* won = u8"원"; const char8_t* ship = u8"십"; @@ -88,7 +89,10 @@ int main(int argc, char **argv) { --argc; ++argv; while(argc > 0) { - if(std::strcmp(argv[0], "--max") == 0 && argc > 1) { + if(std::strcmp(argv[0], "--help") == 0 || std::strcmp(argv[0], "-h") == 0) { + help(); + return 0; + } else if(std::strcmp(argv[0], "--max") == 0 && argc > 1) { --argc; ++argv; max = std::strtoull(argv[0], nullptr, 0); } @@ -104,7 +108,25 @@ int main(int argc, char **argv) { value = r_dist(r_eng); } - printf("\nGot value \"%llu\", hit enter to continue...", value); + printf("\nGot value \""); + { + std::string s; + unsigned long long temp = value; + unsigned char count = 0; + while(temp > 0) { + ++count; + s.push_back('0' + temp % 10); + temp /= 10; + if(count == 3 && temp > 0) { + s.push_back(','); + count = 0; + } + } + std::reverse(s.begin(), s.end()); + std::cout << s; + } + printf("\", hit enter to continue..."); + std::cin.get(); std::cout << "Result: ";