填空题
下列程序的输出结果是
【15】
。
#include <iostream>
using namespace std;
template <typename T>
T total(T* data) Ts=0;
while(*data)
s+=*data++;
return s;int main() int x[]=2,4,6,8,0,12,14,16,18;
cout<<total(x)<<end1;
return 0;
【参考答案】
T
点击查看答案
<上一题
目录
下一题>
热门
试题
填空题
下面程序的输出结果是 【14】 。#define MIN(a,b) (((a)<(b))a:b)#include <iostream.h>void main()int x= 3, y=5;cout<< MIN(x,y)<<end1;
点击查看答案
填空题
如果不使用多态机制,那么通过基类的指针虽然可以指向派生类对象,但是只能访问从基类继承的成员。下列程序没有使用多态机制,其输出结果是 【13】 。#include <iostream>using namespace std;class Base public:void print () ctout << ’B’; ;class Derived; public Base public:void print () cout <<’D’; ;int main()Derived* pd= new Derived();Base* pb = pd;pb->print();pd->print();delete pd;return ();
点击查看答案
相关试题
设有以下程序段:int a[5]={0},*...
假定MyClass 为一个类,则该类的拷贝构造...
下面关于成员函数重载运算符和友元函数重载...
磁盘文件操作中,打开磁盘文件的访问模式常...
关于语句#include<iostream>using name...