单选题
假设有函数模板定义如下,下列各选项中正确的是( )。 Template <class T> T Max(T a,T b,T c) { if(a<b) {if(b<c) return c; else return b;} else {if(a<c) return c; else return a;} }
A、
float x,y,z;float max;max=Max(x,y,;
B、
float x;int y,z;float max;max=Max(x,y,;
C、
float x;double y,z;float max;max=Max(x,y,;
D、
三个选项都正确
【正确答案】
A
【答案解析】
[解析] 使用函数模板,要求形参必须为相同类型。
提交答案
关闭