diff options
| author | Syndamia <kamen@syndamia.com> | 2023-11-02 15:00:22 +0200 |
|---|---|---|
| committer | Syndamia <kamen@syndamia.com> | 2023-11-02 15:00:22 +0200 |
| commit | d09b1a288ae51fe2e141676948d225296f2f7d72 (patch) | |
| tree | 7e3666545c04c4602be5374859001bf03e98f4b3 /week03/exercise05.cpp | |
| parent | fbbe586d25b1ebaf66fe2e92e1986bb5debf961d (diff) | |
| download | upp-2023-solutions-d09b1a288ae51fe2e141676948d225296f2f7d72.tar upp-2023-solutions-d09b1a288ae51fe2e141676948d225296f2f7d72.tar.gz upp-2023-solutions-d09b1a288ae51fe2e141676948d225296f2f7d72.zip | |
[w3] Added solutions
Diffstat (limited to 'week03/exercise05.cpp')
| -rw-r--r-- | week03/exercise05.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/week03/exercise05.cpp b/week03/exercise05.cpp new file mode 100644 index 0000000..0facfdb --- /dev/null +++ b/week03/exercise05.cpp @@ -0,0 +1,24 @@ +#include <iostream> + +int main() { + int countLower = 0, countUpper = 0, countDigit = 0; + char input; + std::cin >> input; + while (input != '$') { + if (input == '@') { + return 0; + } + // Грешка ли е, че тук има "if" вместо "else if"? + if ('a' <= input && input <= 'z') { + countLower++; + } + else if ('A' <= input && input <= 'Z') { + countUpper++; + } + else if ('0' <= input && input <= '9') { + countDigit++; + } + std::cin >> input; + } + std::cout << "Lowercase: " << countLower << " Uppercase: " << countUpper << " Digit: " << countDigit << std::endl; +} |
