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 do you mean by delegate? Can a user retain delegates?
Why do we use iterators?
Tell me an example where stacks are useful?
What is a c++ class?
What is the difference between prefix and postfix versions of operator++()?
What is the use of setprecision in c++?
Describe about storage allocation and scope of global, extern, static, local and register variables?
What is the full form of ios?
Is overriding possible in c++?
What is java and c++?
Which c++ compiler is best?
What is c++ code?
What are the benefits of oop in c++?
Explain how an exception handler is defined and invoked in a Program.
Is rust better than c++?