DS File Format
DS File Format
DEPARTMENT OF INFORMATION
TECHNOLOGY
Practical File
(LANDRAN)
INDEX
10
11
12
13
14 i.
15 i.
16
17
18
19
20
Experiment No: 1
Title: Write a program to insert a new element at end as well as at a given
position in an array.
Program Code:
#include <iostream>
int main () {
cin>>n;
cin>>A[c];
cin>>ch;
if (ch == 1) {
pos=n+1;
cin>>value;
Roll No: Page 3
Department of Information Technology
A[pos] = value;
cout<<A[c]<<" ";
else {
cin>>pos;
A[j+1] =A[j];
cin>>A[pos];
cout<<A[j]<<"\t";
Output of Code: