From d09b1a288ae51fe2e141676948d225296f2f7d72 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 2 Nov 2023 15:00:22 +0200 Subject: [w3] Added solutions --- week03/exercise03.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 week03/exercise03.cpp (limited to 'week03/exercise03.cpp') diff --git a/week03/exercise03.cpp b/week03/exercise03.cpp new file mode 100644 index 0000000..bc7879b --- /dev/null +++ b/week03/exercise03.cpp @@ -0,0 +1,19 @@ +#include + +int main() { + char input; + std::cin >> input; + while (input != '^') { + if (('A' <= input && input <= 'Z') || + ('a' <= input && input <= 'z')) { + std::cout << "letter" << std::endl; + } + else if ('0' <= input && input <= '9') { + std::cout << "digit" << std::endl; + } + else { + std::cout << "other" << std::endl; + } + std::cin >> input; + } +} -- cgit v1.2.3