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
What is the use of class in c++?
Explain the static member function.
What are put and get pointers?
write a function signature with various number of parameters.
What is buffering in c++?
What are the unique features of C++.
What do you understand by zombie objects in c++?
Are c and c++ similar?
What is polymorphism & list its types in c++?
What are literals in C++?
How do I run a program in notepad ++?
Explain linear search.
How can you quickly find the number of elements stored in a static array?
What is #include iomanip?
What new()is different from malloc()?