include vcl include iostream using namespace std void main int mass -3

 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
34
35
36
37
38
39
40
41
42
43
44
#include <vcl.h>
#include <iostream>
using namespace std;
void main()
{
int mass[] = {-3, -5, 100, 5, 0, -99, 3, 1}; //32
int size_mass = sizeof(mass)/sizeof(mass[0]); //32/4
int mass_max = mass[0];
int mass_min = mass[0];
int index_max = 0;
int index_min = 0;
int temp;
for(int i = 0; i < size_mass; i++)
{
if(mass[i] > mass_max)
{
mass_max = mass[i];
index_max = i;
}
else
{
if(mass[i] < mass_min)
{
mass_min = mass[i];
index_min = i;
}
}
}
temp = max_min;
mass[index_min] = max_mass;
mass[index_mass] = t
cout << index_max << " mass_max = " << mass_max;
cout << "\n" << index_min << " mass_min = " << mass_min;
cin.get();
}