Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- using namespace std;
- int main() {
- int n, a[10010];
- cout << "Vvedite kolichestvo elementov: " << endl;
- cin >> n;
- cout << "Vvedite elementi massiva:" << endl;
- for(int i = 0; i < n; i++)
- cin >> a[i];
- int max = 0, x = 0;
- for(int j = 1; j < n - 1; j++)
- if (a[j] > a[max])
- max = j;
- x = a[max - 1];
- cout << "x:" << x << endl;
- for(int i = 0; i < n; i++) {
- if (a[i] < x) {
- for(int j = i + 1; j < n; j++)
- a[j - 1] = a[j];
- --n;
- --i;
- }
- }
- cout << "Obnovlenniy massiv:" << endl;
- for(int i = 0; i < n; i++)
- cout << a[i] << " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement