-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.cpp
More file actions
60 lines (59 loc) · 862 Bytes
/
array.cpp
File metadata and controls
60 lines (59 loc) · 862 Bytes
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
59
#include<iostream>
using namespace std;
class arrange
{
private:
int n[100];
int even[10],odd[10];
int size,j=0,k=0;
public:
void sort(int arr[],int n)
{
int t=0;
for(int i=0;i<size;i++)
{
for(int j=i+1;j<size;j++)
{
if(arr[i]>arr[j])
{
t =arr[i];
arr[i]=arr[j];
arr[j]=t;
}
}
}
for(int i=0;i<size;i++)
cout<<arr[i]<<" ";
}
void input()
{
cout<<"Enter size of the array:"<<endl;
cin>>size;
cout<<"\nEnter the numbers in the array:";
for(int i=0;i<size;i++)
{
cin>>n[i];
}
for(int i=0;i<size;i++)
{
if (num[i]%2 == 0)
{
even[j]=num[i];
j++;
}
else
{
odd[k]=num[i];
k++;
}
}
sort(odd,k);
sort(even,j);
}
};
int main()
{
arrange obj;
obj.input();
return 0;
}