doubly link list in c++

Upload: irfanchandmian

Post on 08-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 Doubly link list in C++

    1/3

    #include#include#include#includestruct student{

    int Rno;

    char name[20];student *prev;student *next;

    };void makelist(student *sptr);void insert(student *sptr);void traverse(student *sptr);void Del(student *sptr);void search(student *sptr);void Start(student *strt);void main(){

    clrscr();student *strt;char a='y';strt=new student;cout

  • 8/7/2019 Doubly link list in C++

    2/3

    void makelist(student *sptr){

    sptr->prev=0;char what='y';while(what=='y'){

    coutRno;sptr->next=0;coutwhat;if(what=='y'){

    sptr->next=new student;sptr->next->prev=sptr;sptr=sptr->next;

    }}}void traverse(student *sptr){

    char cond,P;clrscr();coutcond;while(sptr!=0){

    cout

  • 8/7/2019 Doubly link list in C++

    3/3

    chk++;

    }sptr=sptr->next;

    }if(chk==-1)coutposition;int point=1;student *ptr;ptr=&item;while(pointnext=sptr->next;ptr=sptr->next;

    }sptr=sptr->next;point++;

    }}void Del(student *sptr){

    int position,point=1;coutposition;

    student *ptr;while(pointnext=sptr->next;}ptr=sptr;sptr=sptr->next;

    }}