From 732276e54fa39198d169b558311cea2540938049 Mon Sep 17 00:00:00 2001 From: Walter Date: Thu, 4 Jun 2020 23:18:59 -0700 Subject: [PATCH] Update 5.14.cpp --- ch5/5.14.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ch5/5.14.cpp b/ch5/5.14.cpp index 0da4fe3..22f5c7f 100644 --- a/ch5/5.14.cpp +++ b/ch5/5.14.cpp @@ -20,8 +20,11 @@ int main() { maxDuplicatedWord = duplicatedWord; maxCnt = cnt; } - std::cout << maxDuplicatedWord << " occurs " << maxCnt - << " time" << (maxCnt > 1 ? "s" : "") << ". " << std::endl; - + if (maxCnt > 1) { + std::cout << maxDuplicatedWord << " occurs " << maxCnt + << " times." << std::endl; + } else { + std::cout << "No word was repeated." << std::endl; + } return 0; }