#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c=0,d,no,j;
cout<<"\nenter the size af array :";
cin>>a;
int *x=new int[a];
cout<<"\n Now the size of array is= "<<a; x[a]=NULL;
cout<<"\n first enter a no of values u want enter: ";
cin>>b;
for(int q=1;q<=b;q++)
{
cout<<"\n enter a value for x["<<q<<"] =";
cin>>x[q]; c++;
}
{
for(int w=1;w<=b;w++)
cout<<"\n The value u enter at "<<w<<"is "<<x[w];
}
cout<<"\n Displaing whole array :";
for(int i=1;i<=a;i++)
cout<<"\n the value at index "<<i<<" is "<<x[i];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
cout<<"\n\n----________-----_-----__---_-_--------_---_-_-_--_-__-_-_-__-";
cout<<"\n\t INSERTION\n\n enter index u want to insert value";
cin>>d;
if(c>a)
cout<<"\n sorry no space in array";
else
{{
for(j=c;j>=d;j--)
x[j+1]=x[j];
}
cout<<"\n Enter value at index "<<d;
cin>>no;
x[d]=no;c++;
}
cout<<"\n Displaing whole array :";
for(int r=1;r<=a;r++)
cout<<"\n the value at index "<<r<<" is "<<x[r];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
clrscr();
cout<<"\n\n----________-----_-----__---_-_--------_---_-_-_--_-__-_-_-__-";
cout<<"\n\t DELETION\n\n enter index u want to delet value";
cin>>d;
{{
for(j=d;j<=c;j++)
x[j]=x[j+1];
} c--;
cout<<"\n Displaing whole array :";
for(int r=1;r<=a;r++)
cout<<"\n the value at index "<<r<<" is "<<x[r];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
} }
#include<conio.h>
void main()
{
int a,b,c=0,d,no,j;
cout<<"\nenter the size af array :";
cin>>a;
int *x=new int[a];
cout<<"\n Now the size of array is= "<<a; x[a]=NULL;
cout<<"\n first enter a no of values u want enter: ";
cin>>b;
for(int q=1;q<=b;q++)
{
cout<<"\n enter a value for x["<<q<<"] =";
cin>>x[q]; c++;
}
{
for(int w=1;w<=b;w++)
cout<<"\n The value u enter at "<<w<<"is "<<x[w];
}
cout<<"\n Displaing whole array :";
for(int i=1;i<=a;i++)
cout<<"\n the value at index "<<i<<" is "<<x[i];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
cout<<"\n\n----________-----_-----__---_-_--------_---_-_-_--_-__-_-_-__-";
cout<<"\n\t INSERTION\n\n enter index u want to insert value";
cin>>d;
if(c>a)
cout<<"\n sorry no space in array";
else
{{
for(j=c;j>=d;j--)
x[j+1]=x[j];
}
cout<<"\n Enter value at index "<<d;
cin>>no;
x[d]=no;c++;
}
cout<<"\n Displaing whole array :";
for(int r=1;r<=a;r++)
cout<<"\n the value at index "<<r<<" is "<<x[r];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
clrscr();
cout<<"\n\n----________-----_-----__---_-_--------_---_-_-_--_-__-_-_-__-";
cout<<"\n\t DELETION\n\n enter index u want to delet value";
cin>>d;
{{
for(j=d;j<=c;j++)
x[j]=x[j+1];
} c--;
cout<<"\n Displaing whole array :";
for(int r=1;r<=a;r++)
cout<<"\n the value at index "<<r<<" is "<<x[r];
cout<<"\n Total values u enter right now are \"counter=\""<<c;
} }
0 comments:
Post a Comment