#include<stdio.h> #include<string.h> #include<conio.h> #include<iostream> using namespace std; typedef struct student { int data; struct student *pre; struct student *next; }dnode; dnode *create() { int cycle=1; dnode *head,*p,*s; int x; head=(dnode*)malloc(sizeof(dnode)); p=head; while(cycle) { printf("input data/n"); scanf("%d/n",&x); if(x!=0) { s=(dnode*)malloc(sizeof(dnode)); s->data=x; printf("%d/n",s->data); s->pre=p; p->next=s; p=s; } else { cycle=0; } } head=head->next; head->pre=NULL; s->next=NULL; return(head); } int length(dnode *head) { dnode *p; int n=0; p=head; while(p!=NULL) { p=p->next; n++; } return (n); } void print(dnode *head) { dnode *p; p=head; if(head!=NULL) while(p!=NULL) { printf("%d ",p->data); p=p->next; } }//