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
When must you use a pointer rather than a reference?
Why do we use vector in c++?
What is the size of a vector?
What is c++ w3school?
How are virtual functions implemented in c++?
Comment on assignment operator in c++.
When to use “const” reference arguments in a function?
What is the use of dot in c++?
Is java made in c++?
Explain "const" reference arguments in function?
Do class method definitions?
what is upcasting in C++?
What is object oriented programming (oop)?
Can we delete this pointer in c++?
What is a stack? How it can be implemented?