| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

问题点数：0 回复次数：3

#include<stdio.h>
#include<math.h>
void main()
{
int i,j,k;

double a1[3]={1,2,3    },a2[10][3]={{2,3,4},{3,4,5},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18},{19,20,21},{22,23,24},{25,26,27}};

double D0[10],D1[10],D2[10],D3[10],D4[10],D5[10],D6[10],D7[10],D8=0,D9=0,D10=0,D11=0,D12=0,h,l,t;
for(i=0;i<10;i++)
{
D0[i]=fabs(a1[3]-a2[i][3]);  D1[i]=fabs(a1[3]-a2[i][3]);
}
for(i=0;i<10;i++)
{
D8+=D0[i];
}
for(i=0;i<10;i++)
{
printf("%lf\n ",D0[i]);
}
printf("\n");

for(i=0;i<10-1;i++)
for(j=i+1;j<10;j++)
{
if(D1[i]>D1[j])
{
t=D1[i];
D1[i]=D1[j];
D1[j]=t;
}
}
for(i=0;i<10;i++)
{
printf("%lf\n ",D1[i]);
}
printf("\n");
}

[此贴子已经被作者于2020-5-23 16:07编辑过]

92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000

92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000
92559631349317831000000000000000000000000000000000000000000000.000000

Press any key to continue

#include<stdio.h>
#include<math.h>
void main()
{
int i,j,k;

double a1[3]={1,2,3    },a2[10][3]={{2,3,4},{3,4,5},{4,5,6},{7,8,9},{10,11,12},{13,14,15},{16,17,18},{19,20,21},{22,23,24},{25,26,27}};

double D0[10],D1[10],D2[10],D3[10],D4[10],D5[10],D6[10],D7[10],D8=0,D9=0,D10=0,D11=0,D12=0,h,l,t;
for(i=0;i<10;i++)
{
D0[i]=fabs(a1[2]-a2[i][2]);  D1[i]=fabs(a1[2]-a2[i][2]);
}
for(i=0;i<10;i++)
{
D8+=D0[i];
}
for(i=0;i<10;i++)
{
printf("%lf\n ",D0[i]);
}
printf("\n");

for(i=0;i<10-1;i++)
for(j=i+1;j<10;j++)
{
if(D1[i]>D1[j])
{
t=D1[i];
D1[i]=D1[j];
D1[j]=t;
}
}
for(i=0;i<10;i++)
{
printf("%lf\n ",D1[i]);
}
printf("\n");
}

1.000000
2.000000
3.000000
6.000000
9.000000
12.000000
15.000000
18.000000
21.000000
24.000000

1.000000
2.000000
3.000000
6.000000
9.000000
12.000000
15.000000
18.000000
21.000000
24.000000

Press any key to continue
• 4
• 1/1页
• 1