#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include<iostream.h>
#define NULL 0
#define N 3  
typedef struct course 
{   
    char cname[20];//学科名
    int score;
}COURSE;
   /*定义常数*/
typedef struct student_node   /*定义数据结构*/
{
       char no[11];//学号        
       char name[15];
      COURSE score[N];
       float sum;
       float average;
       struct student_node *next; 
struct student_node  *prior;
 }STUDENT;
student_node *L;
//void Initlist();
void regist();
void del();
int main()
{
         L=(struct student_node*)malloc(sizeof(struct student_node));
         L->next=L->prior;
    int option;
    while(1)
    {
        cout<<"1.建立(插入)"<<"\n";
        cout<<"2.删除记录"<<"\n";
        cin>>option;
        switch(option)
        {
            case 1:
                regist();
                break;
            case 2:
                del();
                break;
       
        }
    }
    return 0;
}
//////初始化
//void Initlist()
//{
//        L=(struct student_node*)malloc(sizeof(struct student_node));
//    L->next=L->prior;
//}
/////////建立
void regist()
{
    char ch;
    student_node *p,*s;
    do
    {
    s=L;
    p=(struct student_node*)malloc(sizeof(struct student_node));
    cout<<"*********开始建立************"<<"\n";
    cout<<"输入学号   ";
    cin>>p->no;
    cout<<"输入姓名   ";
    cin>>p->name;
    cout<<"输入学科名  ";
    cin>>p->score[0].cname;
    cout<<p->score[0].cname<<"成绩   ";
    cin>>p->score[0].score;
    cout<<"输入学科名   ";
    cin>>p->score[1].cname;
    cout<<p->score[1].cname<<"成绩   ";
    cin>>p->score[1].score;
    cout<<"输入学科名   ";
    cin>>p->score[2].cname;
    cout<<p->score[2].cname<<"成绩   ";
    cin>>p->score[2].score;
    s->next=p;
    p->prior=s;
    s=p;
    p->next=L;
    L->prior=p;
        fflush(stdin);
        cout<<"是否继续建立(Y\N)"<<"\n";
            cin>>ch;
    }while(ch=='Y'||ch=='y');
    return;
}
////////删除
void del()
{
student_node *p,*q=L;
    char  no1[11];
    cout<<"输出要删除学生的学号";
    cin>>no1[11];
    while(p)
    {
    if(!strcmp(p->no,no1))
            break;
        else
        {
            q=p;
            p=p->next;
        }
    }
    if(!p)
    {
    cout<<"不存在此学生的信息."<<"\n";
        return;
    }
    cout<<"请问真的要删除该学生的信息吗?(Y/N)"<<"\n";
    char ch;
    fflush(stdin);
    cin>>ch;
    if(ch=='y'||ch=='Y')
    {
        q->next=p;
        p->next->prior=q;
        free(p);
    }
}
调试没错误 但运行是不能删除



 
											





 
	    

 
	