cpp pgm.docx
TRANSCRIPT
-
7/30/2019 cpp pgm.docx
1/9
Program No : 11
Program to create a class called DLIST (doubly linked list) with the member functions to insert a node at a
specified position and delete a node at a specified position of the list. Demonstrate the operations by displaying th
contents of the list after every operation.***********************************************************************
#include
#include
#include #include
class node
{
public: int num;
node *next;
node *prev;
void display()
{
coutnext=temp;
last=temp;
temp->next=NULL;
}
couttemp->num;
totalnodes++;
}
void display()
{
cout
-
7/30/2019 cpp pgm.docx
2/9
temp=first;
if(temp==NULL)
{
cout
-
7/30/2019 cpp pgm.docx
3/9
curr=temp->prev;
nex=temp->next;
}
}
}
if (found==1)
{
coutprev=curr;
temp->next=NULL;
temp->prev=NULL;
totalnodes--;
cout
-
7/30/2019 cpp pgm.docx
4/9
void main()
{
dlist d;
int rpt = 1;
char c;
clrscr();
while(rpt)
{
cout
-
7/30/2019 cpp pgm.docx
5/9
};
void STUDENT::putdata()
{
cout name;
cout regno;
cout age;
}
class UGstudent:public STUDENT
{
private: int semister;
float fees;
float stipend;
public:
void putugdata();
int getsemister(){
return(semister);
}
};
void UGstudent::putugdata()
{
STUDENT::putdata();
cout semister;
cout fees;
cout stipend;
}
class PGstudent:public STUDENT
{
private: int semister;
float fees;
float stipend;
public:
void putpgdata();
int getsemister(){
return(semister);
}
};
void PGstudent::putpgdata()
{
STUDENT::putdata();
cout
-
7/30/2019 cpp pgm.docx
6/9
cin >> semister;
cout fees;
cout stipend;
}
void main()
{
UGstudent ugstudent[MAX];
PGstudent pgstudent[MAX];
clrscr();
cout
-
7/30/2019 cpp pgm.docx
7/9
++tco6;
break;
case 7 : tempage=ugstudent[i].getage();
total7 += tempage;
++tco7;
break;
case 8 : tempage=ugstudent[i].getage();
total8 += tempage;
++tco8;
break;
}
}
clrscr();
cout
-
7/30/2019 cpp pgm.docx
8/9
{
cout
-
7/30/2019 cpp pgm.docx
9/9
cout