单项选择题

下面程序的输出结果是( )。
#include <iostream>
using namespace std;
void main( )
inta[3][3] =1,2,3,4,5;
int s =0;
for(int i=1;i<3;i++)
for(int j=0;j<=i;j++) s+=a[i][j];
cout<<s<<endl;

A.12
B.4
C.15
D.13
<上一题 目录 下一题>
热门 试题

单项选择题
下面程序的输出结果是( )。 #include <iostream> using namespace std; int fun (int, int); fun ( ) 函数的说明 void main( ) int a =48,b =36,c; c = fun(a,B) ; cout<<c; int fun(int u,int v) int w; while (v) w=u%v;u =v;v =w; return u;
A.24
B.12
C.48
D.36
单项选择题
关于下面程序的说法,正确的是( )。 #include <iostream> using namespace std; class x int a; public: x()a=3; int geta( ) cout<<a<<endl; return a; ; class y: x int b; public: x:: geta; A void result ( ) b=geta ( )+8; cont<<b<<endl; ; void main ( ) y yy; B yy. result( ); yy. geta( ); C
A.A行错误,应写成“x::geat()”
B.B行错误,应写成“y yy();”
C.C行错误,不能对私变量引用
D.没有错误,其输出结果为:
3
11
3
相关试题
  • 输出带引号的字符串“hello world!”的语...
  • 将函数模板中的参数实例化后,函数模板变为...
  • 由于静态成员函数不属于某个具体的对象,但...
  • 在定义类的对象时,C++程序将自动调用该...
  • 在派生类中使用基类的成员,可以显式地使用...