box_fractal.c

来自「数据挖掘经典的hierarchial clustering algorithm」· C语言 代码 · 共 33 行

C
33
字号
#include "vector.h"
#include "rectangle.h"
#include "grid.h"
#include "box_fractal.h"

int main(int argc, char **argv) {
Rectangle bound;
Grid      *grid;
double    r[MAX_POINTS];
Vector    tmpv;
ifstream boundfile;
ifstream datafile;

if (argc!=3) print_error("Usage:", "fractal boundfile datafile\n");
boundfile.open(argv[1]);
boundfile >> bound;
for (int i=0; i<MAX_POINTS; i++) {
        boundfile >> r[i];
        grid = new Grid(r[i],bound);
        datafile.open(argv[2]);
        while (!datafile.eof()) {
                datafile >> tmpv;
                if (!datafile.eof())
                        grid->Add(tmpv);
                }
        datafile.close();
        cout << grid->Count() << "\t" << r[i] << "\t"
        << log(grid->Count()) << "\t" << log(r[i]) << endl;
        delete grid;
        }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?