//2d10-1 一维最邻近点对问题
//#include \
#include
#include
using namespace std;
const int L=100;
//点对结构体
struct Pair
{
float d;//点对距离
float d1,d2;//点对坐标
};
float Random();
int input(float s[]);//构造S
float max(float s[],int p,int q);
float min(float s[],int p,int q);
template
void Swap(Type &x,Type &y);
template
int Partition(Type s[],Type x,int l,int r);
Pair CPair(float s[],int l,int r);
int main()
{
srand((unsigned)time(NULL));
int m;
float s[L];
Pair d;
m=input(s);
d=Cpair(s,0,m-1);
cout< cout< return 0; } float Random() { float result=rand()000; return result*0.01; } int input(float s[]) { int length; cout<<\输入点的数目: \ cin>>length; cout<<\点集在X轴上坐标为:\ for(int i=0;i { s[i]=Random(); cout< } return length; }