write a program to insert an element into an array
Answer Posted / awais jamil
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int j,x[6]={1,2,3,4,5};
int i,pos;
cout<<"please enter for position"<<endl;
cin>>pos;
cout<<"enter for number"<<endl;
cin>>j;
for(i=4;i>=pos;i--)
{
x[i]=x[i-1];
}
x[pos]=j;
for(i=0;i<6;i++)
cout<<x[i]<<" ";
getch();
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
List the issue that the auto_ptr object handles?
Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort
What is the advantage of an external iterator.
describe private access specifiers?
When is the destructor called?
What is a map in c++?
What is #include sstream?
Should the this pointer can be used in the constructor?
Explain the difference between using macro and inline functions?
What is long in c++?
What is lambda expression c++?
Differentiate between a copy constructor and an overloaded assignment operator.
What is #include iostream h in c++?
What is nested class in c++?
Define macro.