📄 suredlg.cpp
字号:
// SureDlg.cpp : implementation file
//
#include "stdafx.h"
#include "DirAndDF.h"
#include "SureDlg.h"
#include "ResultDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSureDlg dialog
CSureDlg::CSureDlg(CWnd* pParent /*=NULL*/)
: CDialog(CSureDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSureDlg)
m_takeon = _T("");
//}}AFX_DATA_INIT
}
void CSureDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSureDlg)
DDX_Control(pDX, IDC_SURE, m_surec);
DDX_Control(pDX, IDC_SAVERES, m_saveresc);
DDX_Control(pDX, IDC_NEXT, m_nextc);
DDX_Control(pDX, IDC_BUTTON1, m_resc);
DDX_Text(pDX, IDC_EDIT1, m_takeon);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSureDlg, CDialog)
//{{AFX_MSG_MAP(CSureDlg)
ON_BN_CLICKED(IDC_SURE, OnSure)
ON_BN_CLICKED(IDC_NEXT, OnNext)
ON_WM_CANCELMODE()
ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
ON_BN_CLICKED(IDC_SAVERES, OnSaveres)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSureDlg message handlers
void CSureDlg::OnSure()
{
// TODO: Add your control notification handler code here
CString takeonword[36]={"感情","美好","叹息","罢免","提升","飞机",
"同志","太阳","塌陷","艰苦","中年","愤怒","年代","纳税","马上",
"面对","紧张","来年","万能","浓度","旗袍","让步","罢工","委托",
"公开","扩大","代价","沙漠","粮食","风格","谈吐","简单","时间",
"问题","尽量","蓬松"};
CString word[36]={"宽容","纵横","制约","夸张","出卖","代表","狂欢","水平","经济",
"放肆","践踏","房屋","基础","居住","江南","同时","战友","渴望","白菜","上升","花生",
"知识","亲情","恐怖","树木","书记","样式","记号","名称","描写","使馆","公里","感受",
"功能","消息","文化"};
//CString result[36];
//UpdateData(TRUE);
//result = m_takeon;
if((i-1)==0){
if(ntext[0]<36)
resdui++;
else
rescuo++;}
else{if(ntext[i]<36)
resdui++;
else
rescuo++;
}
m_surec.EnableWindow(FALSE);
}
void CSureDlg::OnNext()
{
CString takeonword[36]={"感情","美好","叹息","罢免","提升","飞机",
"同志","太阳","塌陷","艰苦","中年","愤怒","年代","纳税","马上",
"面对","紧张","来年","万能","浓度","旗袍","让步","罢工","委托",
"公开","扩大","代价","沙漠","粮食","风格","谈吐","简单","时间",
"问题","尽量","蓬松"};
CString word[36]={"宽容","纵横","制约","夸张","出卖","代表","狂欢","水平","经济",
"放肆","践踏","房屋","基础","居住","江南","同时","战友","渴望","白菜","上升","花生",
"知识","亲情","恐怖","树木","书记","样式","记号","名称","描写","使馆","公里","感受",
"功能","消息","文化"};
// TODO: Add your control notification handler code here
if(i==36)
{
AfxMessageBox("测试结束,谢谢");
//CDialog::OnCancel();
m_resc.EnableWindow(TRUE);
m_saveresc.EnableWindow(TRUE);
m_nextc.EnableWindow(FALSE);
m_surec.EnableWindow(FALSE);
}
else{
if(ntext[i]<36){
m_takeon=word[ntext[i]];
if(ntext[i]<12)
tor++;
else if(ntext[i]<24)
tof++;
else
ton++;}
else
m_takeon=takeonword[ntext[i]-36];
i++;
UpdateData(FALSE);
m_surec.EnableWindow(TRUE);
}
}
BOOL CSureDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// m_surec.EnableWindow(FALSE);
m_resc.EnableWindow(FALSE);
m_saveresc.EnableWindow(FALSE);
// TODO: Add extra initialization here
i=1;
rescuo = 0;
resdui = 0;
tof=ton=tor=0;
total=0;
// int ntext[36];
srand((unsigned) time(NULL));
// int ntext[36];
int j=0;int i=0;
for(i=0;i<72;i++){
ntext[i]=rand()%72;
do{
for(j=0;j<i;j++)
if(ntext[j]==ntext[i])
{ ntext[i]=rand()%72;
break;}
}while(j<i);
}
CString takeonword[36]={"感情","美好","叹息","罢免","提升","飞机",
"同志","太阳","塌陷","艰苦","中年","愤怒","年代","纳税","马上",
"面对","紧张","来年","万能","浓度","旗袍","让步","罢工","委托",
"公开","扩大","代价","沙漠","粮食","风格","谈吐","简单","时间",
"问题","尽量","蓬松"};
CString word[36]={"宽容","纵横","制约","夸张","出卖","代表","狂欢","水平","经济",
"放肆","践踏","房屋","基础","居住","江南","同时","战友","渴望","白菜","上升","花生",
"知识","亲情","恐怖","树木","书记","样式","记号","名称","描写","使馆","公里","感受",
"功能","消息","文化"};
m_takeon=word[ntext[0]];
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSureDlg::OnCancelMode()
{
CDialog::OnCancelMode();
// TODO: Add your message handler code here
}
void CSureDlg::OnButton1()
{
// TODO: Add your control notification handler code here
total=tof+ton+tor;
if(ntext[0]<36)
total+=1;
CString str;
str.Format("共出现正确字:%d,您正确:%d,混淆:%d",total,resdui,rescuo);
AfxMessageBox(str);
//CResultDlg dlg;
//dlg.DoModal();
//CDialog::OnCancel();
}
void CSureDlg::OnSaveres()
{
// TODO: Add your control notification handler code here
/*********
出现正确数 判断正确数 混淆数 正确率 混淆率
*******/
CFile file;
file.Open(".\\result.text",CFile::modeCreate|CFile::modeWrite);
file.Write(&total,sizeof(total));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -