Hi, this is Pradeep, I just tried to write a linked list program in c++, here 
is my entire code. When i tried to execute it in Dev C++ I am getting a window 
which states that "mylinkedlist.exe has encountered a problem and needs to 
close. We are sorry for the inconvenience." and it is asking for " Send Error 
Report" or "Don't Send". I was wondering if anyone one figure it out the actual 
problem with it. I am really really suffered alot for this. 


//mylinkedlist.cpp

#include <iostream>
using namespace std;

typedef struct Node{
       
       public:
       Node(int data){
                this->data = data;
                previous = NULL;
                next = NULL;
                }
                int data;
                struct Node* previous;
                struct Node* next;
                }NODE;
class mylinkedlist{
      
      NODE* front;
      NODE* back;
      public:
             mylinkedlist();
             //~mylinkedlist();
             void appendNode(int data1);
             int deleteNode();
            // void traverseFront();
            // void traverseBack();
             //void destroyList();
             };
             
mylinkedlist::mylinkedlist()
{
        front = NULL;
        back = NULL;                            
        }
/*mylinkedlist::~mylinkedlist(){
        destroylist();
        }*/
void mylinkedlist::appendNode(int listdata)
{
        Node* mynode = new Node(listdata);
        if(back == NULL)
        {
                back = mynode;
                front = mynode;
        }
        else
        {
                back->next = mynode;
                mynode->previous = back;
                back = mynode;
        }    
        }                     
int mylinkedlist::deleteNode()
{
        cout<<"This is the data in the last node which is going to be 
deleted"<<back->data<<endl;
        if(back== NULL)
        { 
             cout<<" Our Linked list is Empty";
             }
             else
             { 
                 Node *mynode;
                 mynode = back;
                  back = back->previous;
                  back->next = NULL;
                 
                  }
          return 0;              
}



int main()
{
    mylinkedlist myllist;
    myllist.appendNode(10);
    myllist.appendNode(20);
    myllist.appendNode(30);
    myllist.deleteNode();
    myllist.deleteNode();
    myllist.deleteNode();
    myllist.deleteNode();
   
    return 0;
}



Thanks in advance..

Pradeep.M

                                
---------------------------------
 Here’s a new way to find what you're looking for - Yahoo! Answers 

[Non-text portions of this message have been removed]

Reply via email to