#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;}