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

What is the function of I/O library in C++ ?

1186


Why do we use constructor?

1049


What is an inclusion guard?

1186


What is flush programming?

1009


Is it possible for a member function to use delete this?

1072


Show the declaration for a static function pointer.

1042


What are static variables?

1131


What is a singleton class c++?

1020


What are the operators in c++?

1112


What is the most useful programming language?

1037


Is multimap sorted c++?

1002


Explain how would you handle a situation where you cannot call the destructor of a local explicitly?

964


Explain how a pointer to function can be declared in C++?

1049


Who made c++?

1075


How the delete operator differs from the delete[]operator?

1091