资源简介
密度聚类c++写的,有mfc可视化界面。k均值还没写后面写了再上传。初学者没积分下别人的文档硬刚了半个多月写的,期间踩坑无数,同样没积分的兄弟留言给你百度云分享。有兴趣又有积分的朋友希望能给我贡献两个下载积分------------

代码片段和文件信息
// CDialogGuss.cpp: 实现文件
//
#include “stdafx.h“
#include “mfc_plot.h“
#include “CDialogGuss.h“
#include “afxdialogex.h“
// CDialogGuss 对话框
IMPLEMENT_DYNAMIC(CDialogGuss CDialogEx)
CDialogGuss::CDialogGuss(CWnd* pParent /*=nullptr*/)
: CDialogEx(IDD_DIALOGGUSS pParent)
Guss_equ(0.0)Guss_var(10.0)Guss_num(500)
{
}
CDialogGuss::~CDialogGuss()
{
}
void CDialogGuss::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX IDC_EDITE m_equ);
DDX_Control(pDX IDC_EDITV m_var);
DDX_Control(pDX IDC_EDITN m_num);
m_equ.SetWindowTextW(_T(“0.0“));
m_var.SetWindowTextW(_T(“20.0“));
m_num.SetWindowTextW(_T(“100“));
}
BEGIN_MESSAGE_MAP(CDialogGuss CDialogEx)
ON_BN_CLICKED(IDOK &CDialogGuss::OnBnClickedOk)
END_MESSAGE_MAP()
// CDialogGuss 消息处理程序
void CDialogGuss::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
CString str1=_T(““) str2 = _T(““) str3 = _T(““);
m_equ.GetWindowTextW(str1);
m_var.GetWindowTextW(str2);
m_num.GetWindowTextW(str3);
if (str1==str1.SpanIncluding(_T(“0123456789.-“)) && str2 == str2.SpanIncluding(_T(“0123456789.-“)) && str3 == str3.SpanIncluding(_T(“0123456789“)))
{
Guss_equ = _ttof(str1);
Guss_var = _ttof(str2);
Guss_num = _ttof(str3);
if (Guss_num == 0)
{
MessageBox(_T(“样本数不能小于0!“));
return;
}
CDialogEx::OnOK();
MessageBox(_T(“请左键单击空白处生成样本点“));
return;
}
else {
MessageBox(_T(“请输入正确的参数!均值方差可以为负数小数而数量必须是正整数!“));
return;
}
}
vector> CDialogGuss::GussDataVec(const float equ const float var const int num) {
static double V1 V2 S;
static int phaseX = 0 phaseY =1;
double XY;
vector> my_points;
pair one_point;
for (int i = 0; i != num; ++i) {
if (phaseX == 0) {
do {
double U1 = (double)rand() / RAND_MAX;
double U2 = (double)rand() / RAND_MAX;
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;
} while (S >= 1 || S == 0);
X = V1 * sqrt(-2 * log(S) / S);
}
else
X = V2 * sqrt(-2 * log(S) / S);
phaseX = 1 - phaseX;
X = X * var + equ;
if (phaseY == 0) {
do {
double U1 = (double)rand() / RAND_MAX;
double U2 = (double)rand() / RAND_MAX;
V1 = 2 * U1 - 1;
V2 = 2 * U2 - 1;
S = V1 * V1 + V2 * V2;
} while (S >= 1 || S == 0);
Y = V1 * sqrt(-2 * log(S) / S);
}
else
Y = V2 * sqrt(-2 * log(S) / S);
phaseY = 1 - phaseY;
Y = Y * var + equ;
one_point=make_pair(X Y);
my_points.push_back(one_point);
}
return my_points;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2777 2018-11-25 22:33 mfc_plot\mfc_plot\CDialogGuss.cpp
文件 803 2018-11-19 00:10 mfc_plot\mfc_plot\CDialogGuss.h
文件 1156 2018-11-25 20:55 mfc_plot\mfc_plot\CParameterDlg.cpp
文件 644 2018-11-25 17:16 mfc_plot\mfc_plot\CParameterDlg.h
文件 5315 2018-11-25 22:13 mfc_plot\mfc_plot\dbsacn.h
文件 3296 2018-11-20 21:35 mfc_plot\mfc_plot\DBSCAN.h
文件 8725 2018-11-18 22:46 mfc_plot\mfc_plot\MainFrm.cpp
文件 1295 2018-11-17 15:40 mfc_plot\mfc_plot\MainFrm.h
文件 29624 2018-11-25 17:16 mfc_plot\mfc_plot\mfcplot.rc
文件 4858 2018-11-17 15:40 mfc_plot\mfc_plot\mfc_plot.cpp
文件 715 2018-11-17 15:40 mfc_plot\mfc_plot\mfc_plot.h
文件 10935 2018-11-25 17:16 mfc_plot\mfc_plot\mfc_plot.vcxproj
文件 3293 2018-11-25 17:16 mfc_plot\mfc_plot\mfc_plot.vcxproj.filters
文件 230 2018-11-18 20:01 mfc_plot\mfc_plot\mfc_plot.vcxproj.user
文件 2732 2018-11-18 22:41 mfc_plot\mfc_plot\mfc_plotDoc.cpp
文件 911 2018-11-18 21:28 mfc_plot\mfc_plot\mfc_plotDoc.h
文件 6642 2018-11-25 22:21 mfc_plot\mfc_plot\mfc_plotView.cpp
文件 1438 2018-11-25 14:41 mfc_plot\mfc_plot\mfc_plotView.h
文件 1654 2018-11-15 22:17 mfc_plot\mfc_plot\res\info.bmp
文件 670 2018-11-17 15:40 mfc_plot\mfc_plot\res\mfcplot.rc2
文件 67777 2018-11-15 22:17 mfc_plot\mfc_plot\res\mfc_plot.ico
文件 4710 2018-11-15 22:17 mfc_plot\mfc_plot\res\mfc_plotDoc.ico
文件 1078 2018-11-15 22:17 mfc_plot\mfc_plot\res\Toolbar.bmp
文件 5816 2018-11-15 22:17 mfc_plot\mfc_plot\res\Toolbar256.bmp
文件 7976 2018-11-15 22:17 mfc_plot\mfc_plot\res\userimages.bmp
文件 2682 2018-11-25 16:54 mfc_plot\mfc_plot\resource.h
文件 177 2018-11-17 15:40 mfc_plot\mfc_plot\stdafx.cpp
文件 1085 2018-11-25 17:16 mfc_plot\mfc_plot\stdafx.h
文件 299 2018-11-17 15:40 mfc_plot\mfc_plot\targetver.h
文件 1436 2018-11-25 22:16 mfc_plot\mfc_plot.sln
............此处省略9个文件信息
- 上一篇:学生成绩管理系统v1.0
- 下一篇:黑白棋游戏c语言代码
相关资源
- C++中头文件与源文件的作用详解
- 基于mfc的多线程文件传输
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- MFC数字钟(基于VC6.0)
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- ChartCtrl控件库(可在VS2019中使用)
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
评论
共有 条评论