1141-面向对象程序设计上机练习二(函数模板)

来源:互联网 发布:染发剂哈尼罕淘宝 编辑:程序博客网 时间:2024/05/23 18:42
#include <bits/stdc++.h>using namespace std;template <typename T>T Sort(T n){    T max = -123456;    for(int i = 0; i < 4; i++)    {        if(n >= max)        {            max = n;        }        cin >> n;    }    cout << max << endl;    return 0;}int main(){    int a;    float b;    long c;    cin >> a;    Sort(a);    cin >> b;    Sort(b);    cin >> c;    Sort(c);    return 0;}
阅读全文
0 0
原创粉丝点击