?? 10_4_3.cpp
字號:
//10_4_3
#include <iostream.h>
struct Lnode
{
double data;
Lnode* next;
};
void ShowList(Lnode* head);
void AddToEnd(Lnode* pnew, Lnode*& head);
Lnode* GetNode();
void DeleteList(Lnode* head);
void main()
{
Lnode* head=NULL;
Lnode* temp;
double d;
cout <<"data? ";
cin >>d;
while(d>0&&(temp=GetNode())){
temp->data=d;
AddToEnd(temp, head);
cout <<"data? ";
cin >>d;
}
ShowList(head);
DeleteList(head);
}
void ShowList(Lnode* head)
{
if(head){
cout <<head->data <<endl;
if(head->next)
ShowList(head->next); //遞歸調用
}
}
void AddToEnd(Lnode* pnew, Lnode*& head)
{
if(!head){
head=pnew;
pnew->next=NULL;
}else
AddToEnd(pnew, head->next); //遞歸調用
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -