?? createpass2.cpp
字號:
// CreatePass2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "CreatePass2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
long nminl=1,nmaxl=3;
void CreatePass()
{
#define passwordmax 8
char a[]="0123456789abcdefghijklmnopqrstuvwxyz";
long ndictcount=sizeof(a);
char cpass[passwordmax+2];
long array[passwordmax];
ASSERT(nminl<=nmaxl&&nmaxl<=passwordmax);
long nlenghth=nminl;
register long j,i=0;
bool bnext;
CStdioFile file;
file.Open("E:\\CreatePass2\\dict.txt",CFile::modeCreate|CFile::modeWrite);//
while(nlenghth<=nmaxl)
{
for(i=0;i<passwordmax;i++)
array[i]=0;
bnext=true;
while(bnext)
{
for(i=0;i<nlenghth;i++)
cpass[i]=a[array[i]];
cpass[i]='\0';
file.WriteString(cpass);
file.WriteString("\n");
for(j=nlenghth-1;j>=0;j--)
{
array[j]++;
if(array[j]!=ndictcount-1) break;
else
{
array[j]=0;
if(j==0) bnext=false;
}
}
}
nlenghth++;
}
file.Close();
}
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
cerr << _T("Fatal Error: MFC initialization failed") << endl;
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CString strHello;
strHello="請輸入生成密碼的位數:\n";
cout<<(LPCTSTR)strHello<<endl;
cin>>nmaxl;
strHello.LoadString(IDS_HELLO);
CreatePass();
cout << (LPCTSTR)strHello << endl;
}
return nRetCode;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -