include vcl include iostream void main int mas int stak nu_min_el nu_e

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <vcl.h>
#include <iostream.h>
void main()
{
int mas[] = {4, 8, 3, 2, 0 , 7, 9, 5};
int stak, nu_min_el,nu_el,sum;
int size_mas = sizeof(mas)/sizeof(mas[0]);
for(int i=0; i < size_mas;i++)
{
for(int j=0; j <size_mas - i; j++)
{
if (mas[i] < mas[i+j])
{
stak = mas[i];
mas[i] = mas[i+j];
mas[i+j] = stak;
}
}
}
for (int i = 1; i < size_mas-1; i++)
{
sum += mas[i];
}
for (int i = 0; i < size_mas; i++)
{
cout << mas[i] << ", ";
}
cout << "SUmma elementov bez maksimalnogo i minimalnogo " << sum;
cin.get();
}