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

21.cout<<"Enter another element: ";
22.cin>>num;
23.cout<<"Enter position number: ";
24.cin>>pos;
25.cout<<endl;
26.--pos;
27.for(i=size;i>=pos;i--)
28.a[i+1]=a[i];
29.a[pos]=num;
30.size++;
31.cout<<"New Array: "<<endl;
32.for(i=0;i<size;i++)
33.cout<<"Element at position "<<i+1<<" is "<<a[i]<<endl;

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When must you use a pointer rather than a reference?

1080


Why do we use vector in c++?

1123


What is the size of a vector?

1193


What is c++ w3school?

1153


How are virtual functions implemented in c++?

1118


Comment on assignment operator in c++.

1169


When to use “const” reference arguments in a function?

1123


What is the use of dot in c++?

1129


Is java made in c++?

1117


Explain "const" reference arguments in function?

1107


Do class method definitions?

1093


what is upcasting in C++?

1234


What is object oriented programming (oop)?

1170


Can we delete this pointer in c++?

1272


What is a stack? How it can be implemented?

1224