Function Template

xiaoxiao2021-03-06  14

This should be a new element of C relative to c, which should be developed from the function of the function, is not difficult, it is also very good, mainly skilled. Post a super small template program.

// function template #include

Template t maximum (t a, t b, t c) {t max = a; if (b> max) max = B;

IF (c> max) max = C;

Return Max;}

Int main () {int INT1, INT2, INT3;

COUT << "Input Three Integer Values:"; cin >> INT1 >> INT2 >> INT3; COUT << "The maximum number IS:" << maximum (int1, int2, int3);

FLOAT IN1, IN2, IN3;

Cout << "/ ninput three float value:"; cin >> in1 >> in2 >> in3; cout << "The maximum number is:" << maximum (in1, in2, in3) << endl

Return 0;}

转载请注明原文地址:https://www.9cbs.com/read-49654.html

New Post(0)