📄 node.cpp
字号:
#include "stdafx.h"
#include"MyList.h"
#include<stdio.h>
/*void MyList::add(CString na,CString ag,CString st,CString te,char s[20])
{
if(tail!=0)
{
tail->next=new Node(na,ag,st,te,s);
tail=tail->next;
}
else
head=tail=new Node(na,ag,st,te,s);
tail->next=head;
}*/
Node* MyList::search(CString name)
{
Node *p;
p=head;
if(p==NULL)return 0;
while(p->name!=name)
{
p=p->next;
if(p==head)return 0;
}
return p;
}
Node* MyList::delet(CString na)
{
if(head!=0)
if(head==tail&&na==head->name)
{
delete head;
head=tail=0;
return 0;
}
else
if(na==head->name)
{
Node *temp=head->next;
head=head->next;
tail->next=head;
delete temp;
return head;
}
else
{
Node *pred,*temp;
for(pred=head,temp=head->next;temp!=tail&&!(na==temp->name);pred=pred->next,temp=temp->next);
if(temp!=tail)
{
pred->next=temp->next;
delete temp;
return pred->next;
}
if(na==temp->name)
{
tail=pred;
tail->next=head;
delete temp;
return pred->next;
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -