From 69de8ecfb2df52a6a4ae9d75f6a018ae380cca05 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 25 Oct 2025 18:07:05 +0300 Subject: feat(Week04): Add exercises and solutions --- Week04/Exercise05.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Week04/Exercise05.cpp (limited to 'Week04/Exercise05.cpp') diff --git a/Week04/Exercise05.cpp b/Week04/Exercise05.cpp new file mode 100644 index 0000000..815a751 --- /dev/null +++ b/Week04/Exercise05.cpp @@ -0,0 +1,34 @@ +#include + +int main() { + char operation; + std::cin >> operation; + + if (operation == '_') { + float number; + std::cin >> number; + std::cout << (int)number; + } + else if (operation == '+') { + float a, b; + std::cin >> a >> b; + std::cout << (a + b); + } + else if (operation == '*') { + float a, b; + std::cin >> a >> b; + std::cout << (a * b); + } + else if (operation == 'x') { + float a, b, c; + std::cin >> a >> b >> c; + std::cout << (a * b * c); + } + else if (operation == '.') { + float a, b, c, d; + std::cin >> a >> b >> c >> d; + std::cout << (a * b * c * d); + } + + return 0; +} -- cgit v1.3.1-23-gd82d