We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8154e18 commit f65d0a7Copy full SHA for f65d0a7
CPP/stl/Function Template.cpp
@@ -0,0 +1,26 @@
1
+#include <iostream>
2
+#include<bits/stdc++.h>
3
+using namespace std;
4
+
5
+//general syntax for templates
6
+template <typename T>
7
8
+//funcation creation with templates
9
+T maxi(T a,T b)
10
+{
11
+ if (a>b)
12
+ {
13
+ return a;
14
+ }
15
+ else
16
17
+ return b;
18
19
+}
20
21
+int main()
22
23
+ cout<<maxi<int>(3,6)<<endl;
24
+ cout<<maxi<float>(3.5,6.2)<<endl;
25
+ return 0;
26
0 commit comments