📄 cpn_genview.cpp
字号:
// cPN_genView.cpp : implementation of the CCPN_genView class
//
#include "stdafx.h"
#include "cPN_gen.h"
#include "cPN_genDoc.h"
#include "cPN_genView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView
IMPLEMENT_DYNCREATE(CCPN_genView, CView)
BEGIN_MESSAGE_MAP(CCPN_genView, CView)
//{{AFX_MSG_MAP(CCPN_genView)
ON_COMMAND(ID_MENUITEM32771, OnGen)
ON_COMMAND(ID_TEST, OnTest)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView construction/destruction
CCPN_genView::CCPN_genView()
{
// TODO: add construction code here
}
CCPN_genView::~CCPN_genView()
{
}
BOOL CCPN_genView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView drawing
void CCPN_genView::OnDraw(CDC* pDC)
{
CCPN_genDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView printing
BOOL CCPN_genView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CCPN_genView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CCPN_genView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView diagnostics
#ifdef _DEBUG
void CCPN_genView::AssertValid() const
{
CView::AssertValid();
}
void CCPN_genView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCPN_genDoc* CCPN_genView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCPN_genDoc)));
return (CCPN_genDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCPN_genView message handlers
void CCPN_genView::OnGen()
{
// TODO: Add your command handler code here
CClientDC dc(this);
char s[25] ;
int out[2500];
/*bool a,b,c;
a=1;b=0;
c=a^b;
wsprintf(s," c: %d ",c);
dc.TextOut(100, 100, s);*/
bool sr[11],sn[11],gr[11],gn[11];
CFile f;
CFileException e;
char* pFileName = "test.txt";
if( !f.Open( pFileName, CFile::modeCreate | CFile::modeWrite, &e ) )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}
//dc.textout(100,100,s);
for (long i=0;i<11;i++)
{
sr[i] = 1;
sn[i] = 1;
gr[i] = 1;
gn[i] = 1;
}
for (i = 1 ;i<2048;i++)
{
int io;
char ch[10];
io= sr[10]^gr[4]^gr[8];
if (i%1024==0){f.Write("<br>",5);}
wsprintf(s,"%d",io);
f.Write(s,1);
gn[1] = gr[2]^gr[3]^gr[6]^gr[8]^gr[9]^gr[10];
sn[1] = sr[3]^sr[10];
for(int j=2; j<11;j++)
{
sn[j] = sr[j-1];
gn[j] = gr[j-1];
}
for(j = 1; j<11;j++)
{
sr[j] = sn[j];
gr[j] = gn[j];
}
}
dc.TextOut(100, 150, "done!");
}
void CCPN_genView::OnTest()
{
// TODO: Add your command handler code here
CClientDC dc(this);
for(long i=1; i<20480000;i++)
{
int j=i;
j=j>>7;
}
dc.TextOut(100, 160, "test done!");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -