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
Define Virtual function in C++.
Is oops and c++ same?
What are disadvantages of pointers?
Where must the declaration of a friend function appear?
What is a c++ vector?
Keyword mean in declaration?
What is c++ good for?
Define a nested class.
Is c++ a dying language?
How much do coding jobs pay?
Explain what happens when a pointer is deleted twice?
What is abstraction c++?
What are the various situations where a copy constructor is invoked?
What is function prototyping?
Why is c++ still used?