write a program to insert an element into an array
Answer Posted / vinay kumar
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
int a[50],i,n,j,p;
cout<<"Enter the size of the array : ";
cin>>n;
cout<<"Enter the elements of the array :\n";
for(i=1;i<=n;i++)
{
cin>>a[i];
}
cout<<"Enter the new element to store : ";
cin>>j;
cout<<"Enter the postion : ";
cin>>p;
a[n+1]=a[p];
a[p]=j;
cout<<"The New series is : \n";
for(i=1;i<=n+1;i++)
{ cout<<a[i]<<"\t";
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Explain the static member function.
What does obj stand for?
What is lambda expression c++?
Why do we need constructors in c++?
What is &x in c++?
State the difference between pre and post increment/decrement operations.
What are signs of manipulation?
Declare a class vehicle and make it an abstract data type.
What is a string example?
If dog is a friend of boy, and terrier derives from dog, is terrier a friend of boy?
What is endl c++?
Is c++ vector a linked list?
What are c++ variables?
What is the difference between strcpy() and strncpy()?
How static variables and local variablesare similar and dissimilar?