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

📄 贝叶斯dlg.cpp

📁 本程序是利用贝叶斯算法来实现的一个看病程序
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	}
}

void CMyDlg::OnCheck6() 
{
	// TODO: Add your control notification handler code here
	if(check6)
	{
		check6=false; zheng[5]=0;
	}
	else
	{
		check6=true;zheng[5]=1;
	}
}

void CMyDlg::OnCheck7() 
{
	// TODO: Add your control notification handler code here
	if(check7)
	{
		check7=false; zheng[6]=0;
	}
	else
	{
		check7=true;zheng[6]=1;
	}
}

void CMyDlg::OnCheck8() 
{
	// TODO: Add your control notification handler code here
	if(check8)
	{
		check8=false; zheng[7]=0;
	}
	else
	{
		check8=true;zheng[7]=1;
	}
}

void CMyDlg::OnCheck9() 
{
	// TODO: Add your control notification handler code here
	if(check9)
	{
		check9=false; zheng[8]=0;
	}
	else
	{
		check9=true;zheng[8]=1;
	}
}

void CMyDlg::OnCheck10() 
{
	// TODO: Add your control notification handler code here
	if(check10)
	{
		check10=false; zheng[9]=0;
	}
	else
	{
		check10=true;zheng[9]=1;
	}
}

void CMyDlg::OnCheck11() 
{
	// TODO: Add your control notification handler code here
	if(check11)
	{
		check11=false; zheng[10]=0;
	}
	else
	{
		check11=true;zheng[10]=1;
	}
}

void CMyDlg::OnCheck12() 
{
	// TODO: Add your control notification handler code here
	if(check12)
	{
		check12=false; zheng[11]=0;
	}
	else
	{
		check12=true;zheng[11]=1;
	}
}

void CMyDlg::OnCheck13() 
{
	// TODO: Add your control notification handler code here
	if(check13)
	{
		check13=false; zheng[12]=0;
	}
	else
	{
		check13=true;zheng[12]=1;
	}
}

void CMyDlg::OnCheck14() 
{
	// TODO: Add your control notification handler code here
	if(check14)
	{
		check14=false; zheng[13]=0;
	}
	else
	{
		check14=true;zheng[13]=1;
	}
}

void CMyDlg::OnCheck15() 
{
	// TODO: Add your control notification handler code here
	if(check15)
	{
		check15=false; zheng[14]=0;
	}
	else
	{
		check15=true;zheng[14]=1;
	}
}

void CMyDlg::OnCheck16() 
{
	// TODO: Add your control notification handler code here
	if(check16)
	{
		check16=false; zheng[15]=0;
	}
	else
	{
		check16=true;zheng[15]=1;
	}
}

void CMyDlg::OnCheck17() 
{
	// TODO: Add your control notification handler code here
	if(check17)
	{
		check17=false; zheng[16]=0;
	}
	else
	{
		check17=true;zheng[16]=1;
	}
}

void CMyDlg::OnCheck18() 
{
	// TODO: Add your control notification handler code here
	if(check18)
	{
		check18=false; zheng[17]=0;
	}
	else
	{
		check18=true;zheng[17]=1;
	}
}

void CMyDlg::OnCheck19() 
{
	// TODO: Add your control notification handler code here
	if(check19)
	{
		check19=false; zheng[18]=0;
	}
	else
	{
		check19=true;zheng[18]=1;
	}
}

void CMyDlg::OnCheck20() 
{
	// TODO: Add your control notification handler code here
	if(check20)
	{
		check20=false; zheng[19]=0;
	}
	else
	{
		check20=true;zheng[19]=1;
	}
}

void CMyDlg::OnCheck21() 
{
	// TODO: Add your control notification handler code here
	if(check21)
	{
		check21=false; zheng[20]=0;
	}
	else
	{
		check21=true;zheng[20]=1;
	}
}

void CMyDlg::OnCheck22() 
{
	// TODO: Add your control notification handler code here
	if(check22)
	{
		check22=false; zheng[21]=0;
	}
	else
	{
		check22=true;zheng[21]=1;
	}
}

void CMyDlg::OnCheck23() 
{
	// TODO: Add your control notification handler code here
	if(check23)
	{
		check23=false; zheng[22]=0;
	}
	else
	{
		check23=true;zheng[22]=1;
	}
}

void CMyDlg::OnCheck24() 
{
	// TODO: 4Add your control notification handler code here
	if(check2)
	{
		check24=false; zheng[23]=0;
	}
	else
	{
		check24=true;zheng[23]=1;
	}
}

void CMyDlg::OnCheck25() 
{
	// TODO: Add your control notification handler code here
	if(check25)
	{
		check25=false; zheng[24]=0;
	}
	else
	{
		check25=true;zheng[24]=1;
	}
}

void CMyDlg::OnCheck26() 
{
	// TODO: Add your control notification handler code here
	if(check26)
	{
		check26=false; zheng[25]=0;
	}
	else
	{
		check26=true;zheng[25]=1;
	}
}

void CMyDlg::OnOK() 
{
	// TODO: Add extra validation here
	float p1[4]={1.251,2.109,1.368,0.644};
	float p2[4]={3.365,4.132,2.582,2.842};
	float p3[4]={4.480,2.790,2.344,1.783};
	float p4[4]={-0.564,0.308,4.220,0.127};
	float p5[4]={-0.068,-0.210,-3.320,-2.495};
	float p6[4]={-1.852,0.270,9.925,0.653};
	float p7[4]={3.088,1.391,2.940,1.836};
	float p8[4]={3.214,8.552,4.113,4.513};
    float p9[4]={-1.579,-0.438,5.256,0.041};
	float p10[4]={-1.510,2.151,-1.026,-0.471};
	float p11[4]={0.481,-0.438,5.256,0.041};
	float p12[4]={0.288,1.207,1.257,2.068};
	float p13[4]={1.924,0.972,6.465,-0.554};
    float p14[4]={2.731,4.714,1.473,1.995};
	float p15[4]={3.153,1.281,12.132,0.368};
	float p16[4]={1.348,4.393,0.372,1.492};
	float p17[4]={2.380,4.403,5.692,4.124};
	float p18[4]={4.536,17.874,6.250,8.627};
    float p19[4]={6.766,5.728,9.185,3.833};
	float p20[4]={4.222,10.176,3.745,4.373};
	float p21[4]={3.417,6.210,2.041,5.510};
	float p22[4]={13.061,7.142,8.162,5.083};
	float p23[4]={4.596,4.966,3.217,5.634};
    float p24[4]={6.153,7.193,6.177,5.144};
	float p25[4]={3.060,6.142,2.621,7.216};
	float p26[4]={2.830,5.242,2.621,4.175};
	float p27[4]={-14.378,-27.682,-30.937,-11.707};
	float f[4];
	for(int i=0;i<4;i++)
    f[i]=p27[i]+zheng[0]*p1[i]+zheng[1]*p2[i]+zheng[2]*p3[i]+zheng[3]*p4[i]+zheng[4]*p5[i]+zheng[5]*p6[i]+zheng[6]*p7[i]+zheng[7]*p8[i]+zheng[8]*p9[i]+zheng[9]*p10[i]+zheng[10]*p11[i]+zheng[11]*p12[i]+zheng[12]*p13[i]+zheng[13]*p14[i]+zheng[14]*p15[i]+zheng[15]*p16[i]+zheng[16]*p17[i]+zheng[17]*p18[i]+zheng[18]*p19[i]+zheng[19]*p20[i]+zheng[20]*p21[i]+zheng[21]*p22[i]+zheng[22]*p23[i]+zheng[23]*p24[i]+zheng[24]*p25[i]+zheng[25]*p26[i];
    float max=f[0];
	strcpy(m_s.mychar,"诊断为阴虚血瘀症,请针对用药");
    if(max<f[1])
	{
		max=f[1];strcpy(m_s.mychar,"诊断为阴虚阳亢(火热)症,请针对用药");
	}
if(max<f[2])
	{
		max=f[2];strcpy(m_s.mychar,"诊断为气虚血瘀症,请针对用药");
	}
if(max<f[3])
	{
		max=f[3];strcpy(m_s.mychar,"诊断为风痰阻络症,请针对用药");
	}
if((zheng[0]==0)&&zheng[1]==0&&(zheng[2]==0)&&(zheng[3]==0)&&(zheng[4]==0)&&(zheng[5]==0)&&(zheng[6]==0)&&(zheng[7]==0)&&(zheng[8]==0)&&(zheng[9]==0)&&(zheng[10]==0)&&(zheng[11]==0)&&(zheng[12]==0)&&(zheng[13]==0)&&(zheng[14]==0)&&(zheng[15]==0)&&(zheng[16]==0)&&(zheng[17]==0)&&(zheng[18]==0)&&(zheng[19]==0)&&(zheng[10]==0)&&(zheng[21]==0)&&(zheng[22]==0)&&(zheng[23]==0)&&(zheng[24]==0)&&(zheng[25]==0))
{MessageBox("请选择症状","警告",MB_OK | MB_ICONWARNING);return;}
CRect rectlt1;
GetDlgItem(IDC_STATIC2)->GetWindowRect(rectlt1);ScreenToClient(rectlt1);
InvalidateRect(rectlt1,true);
}

void CMyDlg::OnTimer(UINT nIDEvent) 
{
	// TODO: Add your message handler code here and/or call default
	KillTimer(1);
    

//dc.TextOut( rect.left, rect.top+20, "                                                                        " );
		
	CRect rectlt1;
GetDlgItem(IDC_STATIC3)->GetWindowRect(rectlt1);ScreenToClient(rectlt1);
InvalidateRect(rectlt1,true);
	SetTimer(1,500,NULL);
	CDialog::OnTimer(nIDEvent);
}

⌨️ 快捷键说明

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