double 10 int 10 int for 10 double temp int tempi double 10 for for in

 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
double a[10];
int b[10];
int i = 0;
for (i;i<10;i++)
{
b[i]=i;
}
double temp;
int tempi;
double n = 10;
for (i;i<n;i++)
{
for (int j=0;j<n-1;j++)
{
if (a[j]>a[j+1])
{
temp=a[j];
tempi=b[j];
a[j]=a[j+1];
b[j]=b[j+1];
a[j+1]=temp;
b[j+1]=tempi;
}
}
}
int k = ceil(n/2+1);
cout << "element" << a[k];
cout << "index" << b[k];