填空题
以下函数模板max()的功能是:返回数组a中最大元素的值。请将横线处缺失部分补充完整。
template<typename T>T max (T a[], int n)
T m=a[0];
for (int i=1;i<n;i++)
if (a[i]>m)
【14】
;
return m;
【参考答案】
m=a[i]
点击查看答案
<上一题
目录
下一题>
热门
试题
单项选择题
有以下程序#include <iostream>using namespace std;class sampleprivate: int x;public: sample(int a) x=a; friend double square(sample s);;double square(sample s) return s. x*s. x;int main() sample s1(20),s2(30); cout<<square(s2)<<end1; return 0;执行结果是( )。
A.20
B.30
C.900
D.400
点击查看答案
填空题
数据的组织和存储会直接影响算法的实现方式和 【2】 。
点击查看答案
相关试题
定义在类内部的函数被类默认为 【12】 ...
下面是一个栈类的模板,其中push函数将元素...
下面是复数类complex的定义,其中重载的运...