Удалить analysis.cpp
This commit is contained in:
48
analysis.cpp
48
analysis.cpp
@@ -1,48 +0,0 @@
|
||||
#include <iostream>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
double Sum = 0;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
Sum += profit[i];
|
||||
}
|
||||
|
||||
cout << "\nРезультати аналiзу:" << endl;
|
||||
cout << "Мiсяць з максимальним прибутком: " << months[maxIndex]
|
||||
<< " (прибуток: " << profit[maxIndex] << ")" << endl;
|
||||
cout << "Мiсяць з мiнiмальним прибутком: " << months[minIndex]
|
||||
<< " (прибуток: " << profit[minIndex] << ")" << endl;
|
||||
cout << "Загальна сума прибутку за рiк: " << Sum << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user