#include<iostream>
#include<conio.h>
#include<fstream>
#include<sstream>
#define null 0
using namespace std;
int main(){
struct stu{
long num;
string name;
stu *next;};
struct stu *head,*h1,*h2;
h1=h2=new stu;
cout<<"請輸入學號、姓名:"<<endl;
cin>>h1->num>>h1->name;
head=null;
int n=0;
while(h1->num!=0){
?? n=n+1;
?? if(n==1)head=h1;
?? else h2->next=h1;
?? h2=h1;
?? h1=new stu;
?? cin>>h1->num>>h1->name;??
? }
? h2->next=null;
? stu p;
? cout<<"請輸入要刪除的編號:"<<endl;
? cin>>p.num;
? if(head==null){cout<<"鏈表是空的!";goto end;}
? h1=head;
? while(p.num!=h1->num&&h1->next!=null){
???? h2=h1;h1=h1->next;}
???? if(p.num=h1->num){
???? if(h1==head)head=h1->next;
???? else h2->next=h1->next;}
???? else cout<<"沒有找到! "<<endl;
? h1=head;
? if(head!=null)
?? do{cout<<h1->num<<" "<<h1->name<<endl;
?? h1=h1->next;
?? }while(h1!=null);
? end:getch();
? return 0;}
?