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 a c++ class?
What is fflush c++?
Explain rethrowing exceptions with an example?
Why should you learn c++?
What's c++ used for?
Why c++ is called oop?
What are the four partitions in which c++ compiler divides the ram?
Write about a nested class and mention its use?
Explain virtual destructor?
What is an object in c++?
What is the use of 'using' declaration in c++?
What are mutator methods in c++?
what is oops and list its features in c++?
What are the differences between the function prototype and the function defi-nition?
Explain the concept of memory leak?