-
Notifications
You must be signed in to change notification settings - Fork 0
/
161.cpp
49 lines (46 loc) · 840 Bytes
/
161.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
#include<iostream>
using namespace std;
#define N 5
template <class T>
void sort(T arr[], int SIZE){
for (int i = 0; i < SIZE; i++)
{
for (int j = i+1; j < SIZE; j++)
{
if (arr[i] > arr[j])
{
T temp;
temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
}
int main(){
int int_array[N];
float float_array[N];
cout<<"Entner integer array elements:"<<endl;
for (int i = 0; i < N; i++)
{
cin>>int_array[i];
}
cout<<"Entner floating array elements:"<<endl;
for (int i = 0; i < N; i++)
{
cin>>float_array[i];
}
sort(int_array,N);
sort(float_array, N);
cout<<"After sorting they are :"<<endl;
for (int i = 0; i < N; i++)
{
cout<<int_array[i]<<", ";
}
cout<<endl;
for (int i = 0; i < N; i++)
{
cout<<float_array[i]<<", ";
}
return 0;
}