#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(int a, int b)
{
return a > b ? 1 : 0;
}
int main()
int n;
cin >> n;
vector <int> a(n);
for(int i = 0; i < n; ++i)
cin >> a[i];
sort(a.begin(), a.end(), cmp);
cout << a[i] << " ";
return 0;
using std::cin;
using std::cout;
int main(int argc, char const* argv[]) {
cout << "Enter size of array:\n";
int *mas1 = new int[n];
int *mas2 = new int[n];
cout << "Enter elements of array:\n";
for (register int i = 0; i < n; i++) {
cin >> mas1[i];
int counter = 0;
if (mas1[i] < 0) {
mas2[counter] = mas1[i];
counter++;
if (mas1[i] == 0) {
if (mas1[i] > 0) {
cout << mas2[i] << std::endl;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(int a, int b)
{
return a > b ? 1 : 0;
}
int main()
{
int n;
cin >> n;
vector <int> a(n);
for(int i = 0; i < n; ++i)
cin >> a[i];
sort(a.begin(), a.end(), cmp);
for(int i = 0; i < n; ++i)
cout << a[i] << " ";
return 0;
}
#include <iostream>
using std::cin;
using std::cout;
int main(int argc, char const* argv[]) {
int n;
cout << "Enter size of array:\n";
cin >> n;
int *mas1 = new int[n];
int *mas2 = new int[n];
cout << "Enter elements of array:\n";
for (register int i = 0; i < n; i++) {
cin >> mas1[i];
}
int counter = 0;
for (register int i = 0; i < n; i++) {
if (mas1[i] < 0) {
mas2[counter] = mas1[i];
counter++;
}
}
for (register int i = 0; i < n; i++) {
if (mas1[i] == 0) {
mas2[counter] = mas1[i];
counter++;
}
}
for (register int i = 0; i < n; i++) {
if (mas1[i] > 0) {
mas2[counter] = mas1[i];
counter++;
}
}
for (register int i = 0; i < n; i++) {
cout << mas2[i] << std::endl;
}
return 0;
}