Website Summary Files Commits Branches @commit @diff @stats
path: root / Week06 / Exercise11.cpp
diff options
context:
space:
mode:
1 files changed, 24 insertions, 0 deletions
-rw-r--r--Week06/Exercise11.cpp24
diff --git a/Week06/Exercise11.cpp b/Week06/Exercise11.cpp
new file mode 100644
index 0000000..d9e421b
--- /dev/null
+++ b/Week06/Exercise11.cpp
@@ -0,0 +1,24 @@
+#include <iostream>
+
+int main() {
+ const double PI = 3.14159;
+
+ double x, y;
+ std::cin >> x >> y;
+
+ const double RED_X = 1.0, RED_Y = -0.5, RED_R = 2.0;
+ bool outside_red = (x - RED_X) * (x - RED_X) + (y - RED_Y) * (y - RED_Y) > RED_R * RED_R;
+
+ /* Представяме трите страни на триъгълника като наклонени прави.
+ */
+ bool below_left_side = y < (5.0 / 3.0) * x + 3.833;
+ bool below_right_side = y < (1.0 / 3.5) * -x + 2.857;
+ bool above_bottom_side = y > (4.0 / 6.5) * x + 0.154;
+
+ if (outside_red && below_left_side && below_right_side && above_bottom_side)
+ std::cout << "Inside" << std::endl;
+ else
+ std::cout << "Outside" << std::endl;
+
+ return 0;
+}