linked list using array final final

 #include <iostream>

 using namespace std;

 void create();

 void insert();

 void deletion();

 void search();

 void display();

 int a,b[100],c,d,e,f,i;

 int main()

 {

     int s;

     cout<<"\nMAIN MENU";

     cout<<"\n\t1-CREATE\n\t2-INSERT\n\t3-DELETION\n\t4-SEARCH\n\t5-DISPLAY";

     do

     {

         cout<<"\nenter ur choice";

         cin>>s;

         switch(s)

         {

           case 1:create();break;

           case 2:insert();break;

           case 3:deletion();break;

           case 4:search();break;

           case 5:display();break;

           default:

           cout<<"invalid attempt";

         }

     }

     while(s<=6);

     return 0;

 }

 void create()

 {

 cout<<"enter no of elements";

 cin>>a;

 cout<<"enter the elements";

 for(i=0;i<a;i++)

 {

     cin>>b[i];

 }

 }

 void insert()

 {

     cout<<"enter no of elements to insert";

     cin>>c;

     cout<<"eneter the elements";

     for(i=0;i<c;i++)

     {

         cin>>b[a++];

     } 

 }

 void deletion()

 {

     cout<<"enter the no to delete";

     cin>>d;

     for(i=0;i<a;i++)

     {

         if(b[i]==d)

     {

     b[i]=0;

     cout<<"deleted elements"<<d;

 }

     }

 }

 void search()

 {

     cout<<"eleements search enter";

     cin>>e;

     for(i=0;i<a;i++)

     {

         if(b[i]==e)

         {

             cout<<"value is "<<i+1;

         }

     }

 }

 void display()

 {

     for(i=0;i<a;i++)

     {

         cout<<"element"<<b[i];

     }

 }


Comments

Popular posts from this blog

LIST ADT USING LINKED LIST

CLASSES CREATION

SORTING PROGRAM