Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

List the issue that the auto_ptr object handles?

965


Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort

1006


What is the advantage of an external iterator.

977


describe private access specifiers?

1133


When is the destructor called?

977


What is a map in c++?

1099


What is #include sstream?

1012


Should the this pointer can be used in the constructor?

970


Explain the difference between using macro and inline functions?

1052


What is long in c++?

1197


What is lambda expression c++?

1003


Differentiate between a copy constructor and an overloaded assignment operator.

1017


What is #include iostream h in c++?

1093


What is nested class in c++?

895


Define macro.

1028