📄 xxsyskk.cpp
字号:
// xxsyskk.cpp : implementation file
//
#include "stdafx.h"
#include "xxgl.h"
#include "xxsyskk.h"
#include "strt.h"
#include "ext.h"
#include "func.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
xxsyskk::xxsyskk(CWnd* pParent /*=NULL*/)
: CDialog(xxsyskk::IDD, pParent)
{
//{{AFX_DATA_INIT(xxsyskk)
m_jsjkkl = 0;
m_jsjyzsy = 0;
m_jsjszsy = 0;
m_ljkkl = 0;
m_ljszsy = 0;
m_ljyzsy = 0;
m_xxmc = _T("");
m_yykkl = 0;
m_yyszsy = 0;
m_yyyzsy = 0;
m_zrkkl = 0;
m_zrszsy = 0;
m_zryzsy = 0;
//}}AFX_DATA_INIT
FILE *fpe;
unsigned char buf[40];
unsigned char pass[40];
int l,i,c,j,k,flag;
unsigned char mask;
rand_base = 1000;
fpe = fopen("c:\\xxsbgl\\mima.txt","rb");
fscanf(fpe,"%s\n%s\n",buf,pass);
fclose(fpe);
l = strlen((char *)buf);
for (i=0;i<l*8;i++){
c = buf[i/8];
mask = 1;
for (j=0;j<i%8;j++)
mask *= 2;
code[i] = c & mask;
if (code[i] != 0)
code[i] = 1;
}
for (i=0;i<1000;i++)
process_flag[i] = 0;
flag = 0;
j = 0;
while (flag == 0){
i = find_a_seat(l*8);
tab[j] = i;
process_flag[i] = 1;
j ++;
if (j == l*8)
flag = 1;
}
for (i=0;i<l*8;i++){
code6[i] = code[tab[i]];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l*8;i++){
j = i + l%7;
if (j >= l*8)
j -= l*8;
code1[i] = code[j];
}
for (i=0;i<l*4;i++){
code2[i] = code1[2*i+1];
}
for (i=0;i<l*8;i++){
j = i + l%7;
if (j > l*8)
j -= l*8;
code3[i] = code[j];
}
for (i=0;i<l*4;i++){
code4[i] = code3[2*i];
}
for (i=0;i<l*4;i++)
code5[i] = code2[i] ^ code4[i];
/*
k = 0;
for (i=0;i<l;i++){
c = code5[i*4]*8 + code5[i*4+1]*4 + + code5[i*4+2]*2 + + code5[i*4+3];
if (c < 10)
c += '0';
else
c += 'A' - 10;
pass[k++] = c;
}
pass[k] = 0;
*/
for (i=0;i<l;i++){
c = pass[i];
if (c >= 'A')
c = c - 'A' + 10;
else
c -= '0';
code5[4*i] = c / 8;
c = c % 8;
code5[4*i+1] = c / 4;
c = c % 4;
code5[4*i+2] = c / 2;
code5[4*i+3] = c % 2;
}
for (i=0;i<l*4;i++)
code2[i] = code5[i] ^ code4[i];
for (i=0;i<l*4;i++){
code1[2*i+1] = code2[i];
}
for (i=0;i<l*8;i++){
j = i - l%7;
if (j < 0)
j = j + l*8;
code[i] = code1[j];
}
for (i=0;i<l*8;i++){
code6[tab[i]] = code[i];
}
for (i=0;i<l*8;i++)
code[i] = code6[i];
for (i=0;i<l;i++){
buf[i] = code[i*8] + code[i*8+1]*2 + code[i*8+2]*4 + code[i*8+3]*8
+ code[i*8+4]*16 + code[i*8+5]*32 + code[i*8+6]*64 + code[i*8+7]*128;
}
strcpy(xiaoming,(char *)buf);
m_xxmc = xiaoming;
char buf1[10],buf2[10],buf3[10],buf4[10],buf5[10],buf6[10],buf7[10],buf8[10],buf9[10],buf10[10];
char buf11[10],buf12[10];
fpe = fopen("c:\\xxsbgl\\xxsyskk.txt","rb");
if (fpe != NULL){
fscanf(fpe,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11,buf12);
m_zryzsy = atoi(buf1);
m_zrszsy = atoi(buf2);
m_zrkkl = atoi(buf3);
m_yyyzsy = atoi(buf4);
m_yyszsy = atoi(buf5);
m_yykkl = atoi(buf6);
m_ljyzsy = atoi(buf7);
m_ljszsy = atoi(buf8);
m_ljkkl = atoi(buf9);
m_jsjyzsy = atoi(buf10);
m_jsjszsy = atoi(buf11);
m_jsjkkl = atoi(buf12);
fclose(fpe);
}
}
void xxsyskk::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(xxsyskk)
DDX_Text(pDX, IDC_jsjkkl, m_jsjkkl);
DDX_Text(pDX, IDC_jsjyzsy, m_jsjyzsy);
DDX_Text(pDX, IDC_jsjszsy, m_jsjszsy);
DDX_Text(pDX, IDC_ljkkl, m_ljkkl);
DDX_Text(pDX, IDC_ljszsy, m_ljszsy);
DDX_Text(pDX, IDC_ljyzsy, m_ljyzsy);
DDX_Text(pDX, IDC_xxmc, m_xxmc);
DDX_Text(pDX, IDC_yykkl, m_yykkl);
DDX_Text(pDX, IDC_yyszsy, m_yyszsy);
DDX_Text(pDX, IDC_yyyzsy, m_yyyzsy);
DDX_Text(pDX, IDC_zrkkl, m_zrkkl);
DDX_Text(pDX, IDC_zrszsy, m_zrszsy);
DDX_Text(pDX, IDC_zryzsy, m_zryzsy);
//}}AFX_DATA_MAP
CBitmap *bitmap;
CBitmap *bitmap1;
HBITMAP hbitmap;
HBITMAP hbitmap1;
bitmap = new CBitmap();
bitmap1 = new CBitmap();
bitmap->LoadBitmap(IDB_qr);
bitmap1->LoadBitmap(IDB_qx);
hbitmap = (*bitmap).operator HBITMAP();
hbitmap1 = (*bitmap1).operator HBITMAP();
CWnd *wn;
CWnd *wn1;
wn = GetDlgItem(IDOK);
wn1 = GetDlgItem(IDCANCEL);
// wn2 = GetDlgItem(IDOK3);
WPARAM wParam;
LPARAM lParam;
wParam = (WPARAM) LOWORD(BS_LEFT | BS_BITMAP); // style
lParam = MAKELPARAM(TRUE, 0); // redraw flag
wn->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmap);
wn1->SendMessage(BM_SETIMAGE, IMAGE_BITMAP,(long)hbitmap1);
}
BEGIN_MESSAGE_MAP(xxsyskk, CDialog)
//{{AFX_MSG_MAP(xxsyskk)
ON_EN_CHANGE(IDC_jsjszsy, OnChangejsjszsy)
ON_EN_CHANGE(IDC_jsjyzsy, OnChangejsjyzsy)
ON_EN_CHANGE(IDC_ljszsy, OnChangeljszsy)
ON_EN_CHANGE(IDC_ljyzsy, OnChangeljyzsy)
ON_EN_CHANGE(IDC_yyszsy, OnChangeyyszsy)
ON_EN_CHANGE(IDC_yyyzsy, OnChangeyyyzsy)
ON_EN_CHANGE(IDC_zrszsy, OnChangezrszsy)
ON_EN_CHANGE(IDC_zryzsy, OnChangezryzsy)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// xxsyskk message handlers
void xxsyskk::OnOK()
{
// TODO: Add extra validation here
FILE *fpe;
char buf1[10],buf2[10],buf3[10],buf4[10],buf5[10],buf6[10],buf7[10],buf8[10],buf9[10],buf10[10];
char buf11[10],buf12[10];
fpe = fopen("c:\\xxsbgl\\xxsyskk.txt","wb");
GetDlgItemText(IDC_zryzsy,buf1,10);
GetDlgItemText(IDC_zrszsy,buf2,10);
GetDlgItemText(IDC_zrkkl,buf3,10);
GetDlgItemText(IDC_yyyzsy,buf4,10);
GetDlgItemText(IDC_yyszsy,buf5,10);
GetDlgItemText(IDC_yykkl,buf6,10);
GetDlgItemText(IDC_ljyzsy,buf7,10);
GetDlgItemText(IDC_ljszsy,buf8,10);
GetDlgItemText(IDC_ljkkl,buf9,10);
GetDlgItemText(IDC_jsjyzsy,buf10,10);
GetDlgItemText(IDC_jsjszsy,buf11,10);
GetDlgItemText(IDC_jsjkkl,buf12,10);
fprintf(fpe,"%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
buf1,buf2,buf3,buf4,buf5,buf6,buf7,buf8,buf9,buf10,buf11,buf12);
fclose(fpe);
CDialog::OnOK();
}
void xxsyskk::OnChangejsjszsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_jsjszsy,buf1,10);
GetDlgItemText(IDC_jsjyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_jsjyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_jsjkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_jsjkkl,"0");
}
}
void xxsyskk::OnChangejsjyzsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_jsjszsy,buf1,10);
GetDlgItemText(IDC_jsjyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_jsjyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_jsjkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_jsjkkl,"0");
}
}
void xxsyskk::OnChangeljszsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_ljszsy,buf1,10);
GetDlgItemText(IDC_ljyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_ljyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_ljkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_ljkkl,"0");
}
}
void xxsyskk::OnChangeljyzsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_ljszsy,buf1,10);
GetDlgItemText(IDC_ljyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_ljyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_ljkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_ljkkl,"0");
}
}
void xxsyskk::OnChangeyyszsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_yyszsy,buf1,10);
GetDlgItemText(IDC_yyyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_yyyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_yykkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_yykkl,"0");
}
}
void xxsyskk::OnChangeyyyzsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_yyszsy,buf1,10);
GetDlgItemText(IDC_yyyzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_yyyzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_yykkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_yykkl,"0");
}
}
void xxsyskk::OnChangezrszsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_zrszsy,buf1,10);
GetDlgItemText(IDC_zryzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_zryzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_zrkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_zrkkl,"0");
}
}
void xxsyskk::OnChangezryzsy()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
char buf1[10],buf2[10];
int t1,t2,t;
float f;
CWnd *wd;
GetDlgItemText(IDC_zrszsy,buf1,10);
GetDlgItemText(IDC_zryzsy,buf2,10);
t1 = atoi(buf1);
t2 = atoi(buf2);
if (t2 > 0){
f = (100.*t1) / t2;
t = f+0.49;
/* if (t > 100){
MessageBox("对不起,您填写的实做实验数大于应做实验数,数据错误.","",MB_OK);
wd = GetDlgItem(IDC_zryzsy);
wd->SetFocus();
return;
}
*/ itoa(t,buf1,10);
SetDlgItemText(IDC_zrkkl,buf1);
}
if ((t1 == 0)&&(t2 == 0)){
SetDlgItemText(IDC_zrkkl,"0");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -