数据挖掘:基于卡方的ChiMerge方法对数值离散化:(课本题目的答案)
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#define SIZE 150
#define OK 1
#define ERROR 0
#define MAX_INTERVAL 6
#define precision 1e-10
using namespace std;
const static char s1[]="Iris-setosa";
const static char s2[]="Iris-versicolor";
const static char s3[]="Iris-virginica";
const int len=20;
int fnum[SIZE][3];
float num[4][SIZE];
float min_loc[]={0,0,0,0,0};
int countnum=0;
int now;
int sort(float *pn,char ps[SIZE][len])
{
register int i,j,k;
float temp;
char s[len];
for(i=0;i<SIZE-1;i++)
for(j=i+1;j<SIZE;j++)
if(pn[i]>pn[j])
{temp=pn[i],strcpy(s,ps[i]);pn[i]=pn[j],strcpy(ps[i],ps[j]);pn[j]=temp,strcpy(ps[j],s);}
return OK;
}
void strcp(char p1[SIZE][len],char p2[SIZE][len])