Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "stdafx.h"
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int n;
- int * a;
- cin >> n;
- a = new int[n];
- for (int i = 0; i < n; i++)
- {
- cin >> a[i];
- }
- int max = a[0];
- for (int i = 1; i < n - 1; i++)
- {
- if (a[i] > a[i + 1] && a[i] > a[i - 1])
- {
- max = a[i];
- cout << "Локальные максимумы: " << max << endl;
- }
- int main()
- {
- int n;
- int * a;
- cin << n;
- a = new int[n];
- for (int i = 0; i < n; i++)
- {
- cin >> a[i];
- }
- int min = a[0];
- for (int i = 1; i < n - 1; i++)
- {
- if (a[i] < a[i + 1] && a[i] < a[i - 1])
- {
- min = a[i];
- cout << "Локальные минимум: " << min << endl;
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement