?? stack.h
字號:
#ifndef STACK_H
#define STACK_H
class node{
public:
unsigned char c;
node* next;
node(char cc,node* n=NULL){c=cc;next=n;}
node(node* n=NULL){next=n;}
};
class stack:public node{
private:
node* head;
int length;
public:
stack(){head=NULL;length = 0;}
~stack()
{
node* temp;
while(head!=NULL)
{
temp=head;
head=head->next;
delete head;
}
}
void push(const unsigned char& cc)
{
node* temp;
temp=head;
head=new node(cc,temp);
++length;
}
bool pop(unsigned char& cc)
{
if(head==NULL)
return false;
node* temp;
temp=head;
head=head->next;
cc=temp->c;
delete temp;
--length;
return true;
}
int getLength()
{
return length;
}
};
#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -