-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.cpp
More file actions
45 lines (33 loc) · 757 Bytes
/
Copy pathtemplate.cpp
File metadata and controls
45 lines (33 loc) · 757 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
#include "bits/stdc++.h"
using namespace std;
// template <typename T>
// T mymax(T x, T y)
// {
// return (x > y) ? x : y;
// }
// int main()
// {
// cout << mymax<int>(2, 5) << endl;
// cout << mymax<float>(12.00, 15.15) << endl;
// return 0;
// }
// write a programm in cpp to find kth smallest of the largest element in an array using template and cpp stl
template <typename T>
T mysort(T x, T y)
{
return (x > y) ? x : y;
}
int main()
{
cout<<"Enter the size of araay : ";
int size;
int arr[size]p;
cin>>size;
for(int i = 0; i<size; i++){
cout<<"arr["<<i<<"] : ";
cin>>arr[i];
}
cout << mymax<int>(2, 5) << endl;
cout << mymax<float>(12.00, 15.15) << endl;
return 0;
}