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
When you overload member functions, in what ways must they differ?
What are the benefits of operator overloading?
Explain queue. How it can be implemented?
What is the use of namespace std in C++?
What is c++ course?
Difference between a copy constructor and an assignment operator.
What is :: operator in c++?
Define a conversion constructor?
Using a smart pointer can we iterate through a container?
What is the difference between ++ count and count ++?
What are the 4 types of library?
What is an orthogonal base class in c++?
What is a lambda function c++?
Can a constructor be private?
What do you mean by static variables?