include vcl include iostream void main int mas 100 int nu_el int size_

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <vcl.h>
#include <iostream.h>
void main()
{
int mas[] = {5, 8, 3, 2, 100 , 7, 9, 5};
int nu_el;
int size_mas = sizeof(mas)/sizeof(mas[0]);
nu_el=mas[0];
for(int i = 0; i < size_mas; i += 2)
{
if (mas[i] < mas[i+1])
{
if (mas[i] + mas[i+1] > mas[nu_el]) nu_el = i;
}
}
cout << "Max summa element y " << mas[nu_el] << " and " << mas[nu_el+1] <<endl;
cout << "Index maximum element " << nu_el << " and " << nu_el+1 <<endl;
cin.get();
}