单项选择题
若有如下程序:
#include <iostream>
using namespaces std;
int s=O;
class sample
static int n;
public:
sample(int i)
n=i;
static void add()
s+=n;
;
int sample::s=O;
int main()
sample a(2),b(5);
sample: :add();
cout<<s<<end1;
return 0;
程序运行后的输出结果是()
A. 2
B. 5
C. 7
D. 3
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
单项选择题
在一个容量为10的循环队列中,若头指针为6,尾指针为1,则此时该循环队列中共有的元素个数为( )。
A) 4
B) 5
C) 6
D) 7
点击查看答案&解析
单项选择题
下列对模板的声明中正确的是( )。
A) template<T>
B) template<classT1,T2>
C) template<class T1,class T2>
D) template<class T1;class T2>
点击查看答案
相关试题
分析下面程序,该程序的运行结果是( )。...
有以下程序:#include <iostream>using...
若变量已正确定义并赋值,以下符合C++语...
下列叙述中正确的是
若有以下定义和语句: int s[4][5]...