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 a lambda function c++?
How can you specify a class in C++?
Explain stack unwinding.
What is a literal in c++?
What character terminates all character array strings a) b) . c) END
Describe the advantage of an external iterator.
what are the iterator and generic algorithms.
How do you declare A pointer to function which receives an int pointer and returns a float pointer
How many types of scopes are there in c++?
What is an iterator?
What is the copy-and-swap idiom?
What is token c++?
Why struct is used in c++?
Is c++ platform dependent?
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends