#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> arr {-5, 2, -2, 0, 5, 4, 5};
int mx = *max_element(arr.begin(), arr.end());
for (auto&& v : arr)
if (v != mx)
cout << v << ' ';
return 0;
}
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> arr {-5, 2, -2, 0, 5, 4, 5};
int mx = *max_element(arr.begin(), arr.end());
for (auto&& v : arr)
if (v != mx)
cout << v << ' ';
return 0;
}