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 / simi

void insert(int*,int pos,int num);
void main()
{
int a[10],num,pos,i;
cout<<"Enter number which is to be inserted";
cin>>num;
cout<<"Enter position where no. is to be inserted";
cin>>pos;
insert(a,1,78);
insert(a,2,3);
getch();
}
void insert(int *a,int pos,int num)
{
int i;
for(i=9;i>=pos;i--)
{
a[i]=a[i-1];
}
a[i]=num;
}

Is This Answer Correct ?    2 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain binary search.

996


Define macro.

1098


Can we make any program in c++ without using any header file and what is the shortest program in c++.

1138


What do you mean by static variables?

1186


What are the new features that iso/ansi c++ has added to original c++ specifications?

1150


write a c++ program to create class student having datamember name,Roll_no,age,and branch intilcization all the member using constructor print the all the details on the screen.

2694


Are vectors faster than arrays?

1009


I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.

1144


what are Access specifiers in C++ class? What are the types?

1239


write a program that withdrawals,deposits,balance check,shows mini statement. (using functions,pointers and arrays)

2397


Is there finally in c++?

1117


What are the advantages of using const reference arguments in a function?

1082


What is an object in c++?

1274


What are the differences between the function prototype and the function defi-nition?

1111


How do you decide which integer type to use?

1017