list.cpp
来自「1、采用(1)盲目搜索(2)启发式搜索对凯撒密文进行自动解密。 2、对替代法加」· C++ 代码 · 共 71 行
CPP
71 行
// List.cpp : implementation file
//
#include "stdafx.h"
#include "AI.h"
#include "List.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// List
List::~List()
{
Node *next;
while(first){
next=first->next;
delete first;
first=next;
}
}
BEGIN_MESSAGE_MAP(List, CWnd)
//{{AFX_MSG_MAP(List)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// List message handlers
int List::Length() const
{
Node *current=first;
int len=0;
while(current){
len++;
current=current->next;
}
return len;
}
int List::Locate(const CString& x) const
{
Node *current=first;
int index=1;
while(current && current->data!=x){
current=current->next;
index++;
}
if(current) return index;
return 0;
}
void List::Insert(const CString& x)
{
Node *y=new Node;
y->data=x;
if(!Empty()){
y->next=first;
first=y;
}
else
first=y;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?