13790 - EE2310_Lec_14_2   

Description

Templates and Generic Programing

You are going to implement a simple function GetMax that returns the bigger object of two. It works for any types/class that can be compared by a > or < operator. Check out function templates for its syntax.

main() is given. Do no make any changes, otherwise you may get penalty points.

int main () { // DO NOT CHANGE MAIN!!
    int i, j;
    double l, m;
    string s1, s2;
    cin >> i >> j >> l >> m >> s1 >> s2;
    cout << GetMax(i, j) << endl << GetMax(l, m) << endl
         << GetMax<string>(s1, s2) << endl;
    return 0;
}

 

Input

4 53 2.2 993.548 oh my!

Output

53
993.548
oh

Sample Input  Download

Sample Output  Download

Tags




Discuss