⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 yuce.cpp

📁 采用c++编写的有关svm交叉验证的程序。
💻 CPP
字号:
// yuce.cpp : 实现文件
//

#include "stdafx.h"
#include "winsvm.h"
#include "yuce.h"
#include ".\yuce.h"


// Cyuce 对话框

IMPLEMENT_DYNAMIC(Cyuce, CDialog)
Cyuce::Cyuce(CWnd* pParent /*=NULL*/)
	: CDialog(Cyuce::IDD, pParent)
	, m_input(_T(""))
	, m_output(_T(""))
	, m_model(_T(""))
{
}

Cyuce::~Cyuce()
{
}

void Cyuce::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT13, m_input);
	DDX_Text(pDX, IDC_EDIT11, m_output);
	DDX_Text(pDX, IDC_EDIT12, m_model);
}


BEGIN_MESSAGE_MAP(Cyuce, CDialog)
	ON_BN_CLICKED(IDC_CHECK13, OnBnClickedCheck13)
	ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
	ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
	ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButton4)
END_MESSAGE_MAP()


// Cyuce 消息处理程序

void Cyuce::OnBnClickedCheck13()
{
    CButton* p13 = (CButton*)GetDlgItem(IDC_CHECK13);
	if (p13->GetCheck())
		predict_probability=1;
	else
		predict_probability=0;
}

void Cyuce::OnBnClickedButton3()
{
    CFileDialog fdlg(true,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"打开预测数据文件 (*.*)|*.*||");
	
	if(fdlg.DoModal()!=IDOK)
	{	
		return;
	}
	m_input=fdlg.GetPathName();
	SetDlgItemText(IDC_EDIT13,m_input);
}

void Cyuce::OnBnClickedButton2()
{
	CFileDialog fdlg(false,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"保存文件 (*.txt)|*.txt||");
	if(fdlg.DoModal()!=IDOK)
	{	
		return;
	}
	m_output=fdlg.GetPathName();	SetDlgItemText(IDC_EDIT11,m_output);
}

void Cyuce::OnBnClickedButton4()
{
    CFileDialog fdlg(true,NULL,NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"打开model文件 (*.model)|*.model||");
	
	if(fdlg.DoModal()!=IDOK)
	{	
		return;
	}
	m_model=fdlg.GetPathName();
	SetDlgItemText(IDC_EDIT12,m_model);
}

BOOL Cyuce::OnInitDialog()
{
	CDialog::OnInitDialog();

	CString sPath;//合成数据源文件路径(在当前文件夹下)
	GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);//返回程序当前路径 d:\...\...\xx.exe
	sPath.ReleaseBuffer ();
	//AfxMessageBox(sPath);
	int nPos;
	//在发行状态,将*.exe & *.mdb放在同一文件夹下即可
	nPos = sPath.ReverseFind('\\');//只去掉 "\xx.exe"
	sPath = sPath.Left (nPos);

    m_output = sPath + "\\output.txt";
    m_model = sPath + "\\heart_scale.model";
    m_input = "<请输入地址>";
	// TODO:  在此添加额外的初始化
	predict_probability=0;
    UpdateData(FALSE);
	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

⌨️ 快捷键说明

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