From 7b3fc8f4bfb8a304e0910c9433b835be8e8513bc Mon Sep 17 00:00:00 2001 From: Misha Date: Thu, 11 Sep 2025 19:40:48 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20analysis.cpp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- analysis.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 analysis.cpp diff --git a/analysis.cpp b/analysis.cpp new file mode 100644 index 0000000..641e8b5 --- /dev/null +++ b/analysis.cpp @@ -0,0 +1,42 @@ +#include +using namespace std; + +int main() { + setlocale(0, ""); + double profit[12]; + + const char* months[12] = { + "Сiчень", "Лютий", "Березень", "Квiтень", + "Травень", "Червень", "Липень", "Серпень", + "Вересень", "Жовтень", "Листопад", "Грудень" + }; + + cout << "Введiть прибуток фiрми за кожен мiсяць року:" << endl; + + for (int i = 0; i < 12; i++) { + cout << months[i] << ": "; + cin >> profit[i]; + } + + int maxIndex = 0; + for (int i = 1; i < 12; i++) { + if (profit[i] > profit[maxIndex]) { + maxIndex = i; + } + } + + int minIndex = 0; + for (int i = 1; i < 12; i++) { + if (profit[i] < profit[minIndex]) { + minIndex = i; + } + } + + cout << "\nРезультати аналiзу:" << endl; + cout << "Мiсяць з максимальним прибутком: " << months[maxIndex] + << " (прибуток: " << profit[maxIndex] << ")" << endl; + cout << "Мiсяць з мiнiмальним прибутком: " << months[minIndex] + << " (прибуток: " << profit[minIndex] << ")" << endl; + + return 0; +} \ No newline at end of file