#include<iostream>
using namespace std;
template<typename T>
T mymax(T a,T b)
{
    return a>b?a:b;
}
int main()
{
    int a,b;
    double x,y;
    char c1,c2;
    cin>>a>>b;
    cout<<"比较两个整数较大的是 "<<mymax(a,b)<<endl;
    cin>>x>>y;
    cout<<"比较两个浮点数较大的是 "<<mymax(x,y)<<endl;
    cin>>c1>>c2;
    cout<<"比较两个字符较大的是 "<<mymax(c1,c2)<<endl;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: