File tree 1 file changed +14
-13
lines changed
practical_exercises/key_exercises
1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change 1
- #include < iostream >
2
- #include < cstring >
1
+ #include < cstring >
2
+ #include < iostream >
3
3
using namespace std ;
4
4
5
-
6
- template < class T > T compareMax (T t1,T t2){
7
- return t1>t2?t1: t2;
5
+ template < class T >
6
+ T compareMax (T t1, T t2) {
7
+ return t1 > t2 ? t1 : t2;
8
8
}
9
9
10
- template <> char * compareMax<char *>(char *s1,char *s2){
11
- return strcmp (s1,s2)>=0 ?s1:s2;
10
+ template <>
11
+ const char *compareMax<const char *>(const char *s1, const char *s2) {
12
+ cout << " [for debug]" << " call compareMax template" << endl;
13
+ return strcmp (s1, s2) >= 0 ? s1 : s2;
12
14
}
13
- int main (int argc, char const *argv[])
14
- {
15
- cout<<compareMax (1 ,2 )<<endl;
16
- cout<<compareMax (" asda" ," qweq" )<<endl;
17
- system (" pause" );
18
- return 0 ;
15
+ int main (int argc, char const *argv[]) {
16
+ cout << compareMax (1 , 2 ) << endl;
17
+ cout << compareMax (" asda" , " qweq" ) << endl;
18
+ system (" pause" );
19
+ return 0 ;
19
20
}
You can’t perform that action at this time.
0 commit comments