Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- // óäàëèòü èç ìàññèâà âñå ìàêñèìàëüíûå ýëåìåíòû
- using namespace std;
- int main (){
- int n, max = INT_MIN;
- cout << "Enter n: ";
- cin >> n;
- int* a = new int [n];
- for (int i = 0; i < n; i++){
- cin >> a[i];
- }
- for (int i = 0; i <= n; i++) {
- if (a[i] >= max){
- max = a[i];
- }
- }
- for (int i = 0; i < n; i++){
- if (a[i] == max){
- a[i] = a[i+1];
- n--;
- }
- }
- for (int i = 0; i < n; i++) cout << a[i] << '\t';
- cout << endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement