Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Arrays.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- using namespace std;
- int main()
- {
- int months[12];
- int dEnd, dBegin;
- for (int i = 0; i < 12; i++)
- {
- cout << "Please enter your income " << i + 1 << endl;
- cin >> months[i];
- }
- cout << "Vvedite nachalo v diapazone" << endl;
- cin >> dBegin;
- cout << "Vvedite konec v diapazone" << endl;
- cin >> dEnd;
- int max = 0, min = 1000000;
- int min_month, max_month;
- for (int c = dBegin; c < dEnd; c++)
- {
- if (max < months[c])
- {
- max = months[c];
- max_month = c + 1;
- }
- if (months[c] < min)
- {
- min = months[c];
- min_month = c + 1;
- }
- }
- cout << "MIN - " << min << " Mesajc " << min_month << endl;
- cout << "MAX - " << max << " Mesajc " << max_month;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement