Skip to main content

Single Link list implementation in C++

LINK LIST PROGRAM Creating Node


  #include using namespace std;
class node{
private :
  int data,size; node *next,*current,*head,*temp;
  public:
   node()
   {
    head=NULL;
    temp=NULL;
    current=NULL;
next=NULL;
size=0;
}
void insert()
   {
    int d;
    cout<<"enter the value for the node :"
cin>>d;
temp=new node; temp->data=d;
temp->next=NULL; size++;
    if(head==NULL)
    { head=temp; current=temp;
} else
{
current->next=temp; current=current->next; }
  }
    void display()

   { temp=head; while(temp!=NULL)
{
     cout<data<next; } } };



int main()
{
node n; n.insert();n.insert();n.insert();n.insert(); n.display();
} for video click to watch video

Comments

Popular posts from this blog

C++ Projects (MAKING DMC )

c++ project of dmc #include<iostream> #include<fstream> #include<iomanip> #include<conio.h> #include<windows.h> using namespace std; class student { protected : char  name[50]; int roll; char board[50]; }; class dmc:public student { protected : float per; int phy; int maths; int cs; int english; public : void getdata() { cout<<"ENTER NAME : "; cin>>name; cout<<"ENTER ROLL : "; cin>>roll; cout<<"PHYSIC MARK : "<<endl; cin>>phy; cout<<"MATHS MARKS :"<<endl; cin>>maths; cout<<"ENTER CS MARKS :"<<endl; cin>>cs; cout<<"ENTER ENGLISH MARKS : "<<endl; cin>>english;    } float calculate() { per=(((phy+maths+cs+english)*(100))/400); return per; } double add() { double total...

C++ project of school mangment system

            C++ SIMPLE PROJECT FOR STORYING RECORDS OF STUDENTS    POST COMMENT FOR ANY ERROR OR IF YOU HAVE ANY PROBLEM WITH THE                                                           CODE  #include<iostream>  #include<windows.h> using namespace std; int main() { string name[3]; int id[3] ; int count=0; int z; int y; int ch; int k; int roll; int c; int dd; char yy; cout<<"*************************WELLCOME TO DATABASE         SYSTM*********************"<<endl; while(1) { cout<<"\t\tpress 1 for entry "<<endl; cout<<"\t\tpress 2 for full data display "<<endl;          cout<<"\t\tpress 3 changing :  "<<endl;           c...