-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11_Question.cpp
58 lines (57 loc) · 1.19 KB
/
11_Question.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include<iostream>
#include<conio.h>
using namespace std;
class array
{
int a[10],n,i,search,pos,x;
public:
read()
{
cout<<"Enter the size of an array"<<endl;
cin>>n;
cout<<"Enter the elements of an array"<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
}
insert()
{
cout<<"enter elements after which you want insert:"<<endl;
cin>>pos;
cout<<"enter element which you want insert in array:";
cin>>x;
for(i=n;i>=pos;i--)
{
a[i]=a[i-1];
}
a[pos-1]=x;
n++;
cout<<"inserted is succesfully\n"<<endl;
}
search()
{
cout<<"Enter the element which you want search in an array"<<endl;
cin>>search;
for(i=0;i<n;i++)
{
if(search==a[i])
{
cout<<"inside if statement";
break;
}
}
}
display()
{
for(i=0;i<n;i++)
{
cout<<"Elements are follow as:"<<endl<<a[i]<<endl;
}
}
};
int main()
{
array b1;
getch();
}