FIXED issues#70 issues#106
This commit is contained in:
parent
9920450b37
commit
6920effd4d
@ -1,19 +1,20 @@
|
|||||||
#include<iostream>
|
#include <cstring>
|
||||||
#include<cstring>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
template<class T> T compareMax(T t1,T t2){
|
T compareMax(T t1, T t2) {
|
||||||
return t1>t2?t1:t2;
|
return t1 > t2 ? t1 : t2;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> char* compareMax<char *>(char *s1,char *s2){
|
template <>
|
||||||
return strcmp(s1,s2)>=0?s1:s2;
|
const char *compareMax<const char *>(const char *s1, const char *s2) {
|
||||||
|
cout << "[for debug]" << " call compareMax template" << endl;
|
||||||
|
return strcmp(s1, s2) >= 0 ? s1 : s2;
|
||||||
}
|
}
|
||||||
int main(int argc, char const *argv[])
|
int main(int argc, char const *argv[]) {
|
||||||
{
|
cout << compareMax(1, 2) << endl;
|
||||||
cout<<compareMax(1,2)<<endl;
|
cout << compareMax("asda", "qweq") << endl;
|
||||||
cout<<compareMax("asda","qweq")<<endl;
|
system("pause");
|
||||||
system("pause");
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user