PhoenixZq
分享是一门艺术~~
摘要: #include <iostream> #include <fstream> #include <string> using namespace std; int main() { const char filename[]="f:\\text.txt"; ofstream o_file; ifstream i_file; string out_text; //写 o_file.open(filename); for(int i =0;i<=12;i++) { o_file<< "a" << 阅读全文
posted @ 2011-10-13 22:12 PhoenixZq 阅读(2746) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <string>using namespace std;int main() { FILE *fd; fd = fopen("f:\\text.txt","rb"); if(!fd) { printf("read file error!"); return 0; } printf("read file success!\n"); char buf[10]; char* str; ... 阅读全文
posted @ 2011-10-13 21:50 PhoenixZq 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 其实这个程序是很早以前写的,只是这两天有人问这个算法,就把程序翻出来,加上了详细的注释。程序很简单,就是从一个observations.txt的文件中读取数据,并把数据对象划分成若干个聚类。具体格式:前3行分别是数据数量、数据维度和聚类数量后面每行为一个数据比如:9342.1 3.0 10.04.0 5.2 -1.05.1 1.5 2.310.5 12.6 10.812.1 10.9 11.04.2 5.3 -9.85.4 1.6 8.7-1.0 -2.1 -0.90.5 0.3 0.4前三行分别表示有9个数据,数据的维度是3,分成是4个聚类。用这个数据运行后,程序打印出划分结果:---- 第 阅读全文
posted @ 2011-10-13 13:56 PhoenixZq 阅读(1452) 评论(0) 推荐(1) 编辑