Question

I need coding of Linked_List_With SPECIFIC TAIL NODE in the C++ programming language.

I need coding of Linked_List_With SPECIFIC TAIL NODE in the C++ programming language.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below>>>


#include <iostream>

using namespace std;

//struct node for link
struct node
{
   int data;
   node *next;
};

//single list
class list
{
private:
   node *head, *tail;
public:
   list()
   {
       head=NULL;
       tail=NULL;
   }

   //adding node to link
   void createnode(int value)
   {
       node *temp=new node;
       temp->data=value;
       temp->next=NULL;
       if(head==NULL)
       {
           head=temp;
           tail=temp;
           temp=NULL;
       }
       else
       {
           tail->next=temp;
           tail=temp;
       }
   }

   //display link
   void display()
   {
       node *temp=new node;
       temp=head;
       while(temp!=NULL)
       {
           cout<<temp->data<<" ";
           temp=temp->next;
       }
   }


};


int main()

{
   //create list
   list myList;
   //add nodes
   myList.createnode(23);
   myList.createnode(3);
   myList.createnode(33);
   myList.createnode(12);
   myList.createnode(32);
   myList.createnode(12);
   myList.createnode(32);
   myList.createnode(9);
   myList.createnode(82);
   myList.createnode(66);
   myList.createnode(66);
   myList.display();
   cout<<endl;
   return 0;
}

OUTPUT:

Add a comment
Know the answer?
Add Answer to:
I need coding of Linked_List_With SPECIFIC TAIL NODE in the C++ programming language.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT