#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define MAX 100
struct {
int x,y;
}zuobiao[MAX];
double zuijin()
{
int i,j,t;
int d=100;
int n=rand()%100+1;
printf(“随机生成的点数为: %d\n”,n);
for(i=0;i<n;i++){
zuobiao[i].x=rand()%100+1;
zuobiao[i].y=rand()%100+1;
printf(“(%d,%d) “,zuobiao[i].x,zuobiao[i].y);
}
for (i = 0; i <n+1; i++)
for (j=i+1; j < n; j++) {
t = (zuobiao[i].x-zuobiao[j].x)*(zuobiao[i].x-zuobiao[j].x)+(zuobiao[i].y-zuobiao[j].y)*(zuobiao[i].y-zuobiao[j].y);
if(d*d>t)d=t;
}
return sqrt(d);
}
void main() {
printf(“\n最近的距离为:%lf\n”,zuijin());
}