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
What is the function to call to turn an ascii string into a long?
What are disadvantages of pointers?
What is the difference between an array and a list?
Define private, protected and public access control.
What is const in c++?
Comment on assignment operator in c++.
What programming language should I learn first?
What is the disadvantage of using a macro?
Define the process of handling in case of destructor failure?
What is c++ try block?
Write a C++ Program to check whether a number is prime number or not?
Can we use struct in c++?
When should I use unitbuf flag?
What is linked list in c++?
What is the full form of ios?