若有以下程序 #include <stdio.h> int a=2; int f(int m) { static int n; n=0; n++; a++; return n+m+a; } main() { int k; for (k=0; k<4; k++) printf("%d,", f(k)); } 则程序的输出结果是()>
A.4,5,6,7,
B.4,7,10,13,
C.4,6,8,10,
D.3,5,7,9,
A.4,5,6,7,
B.4,7,10,13,
C.4,6,8,10,
D.3,5,7,9,
include <iostream>
using namespace std;
class Sample
{
private:
const int n;
public:
Sample(int i) :n(i) {)
void print()
{
cout<<"n="<<n<<end1;
}
};
int main()
{
sample a(10);
a.print();
return 0;
}
上述程序运行后的输出结果是【 】。
B.30
C.10
D.0
include <iostream>
using namespace std;
class Base
{
public:
void who()
{
cout<<"class Base"<<end1;
}
};
class Derivedl : public Base
{
public:
void who()
{
cout<<"class Derivedl"<<end1;
}
};
class Derived2 : public Base
{
public:
void who()
{
cout<<"class Derived2"<<end1;
}
};
int main()
{
Base *p;
Derivedl obj1;
Derived2 obi2;
p=&obj 1;
p=&obj2;
p->who ();
return 0;
}
则该程序运行后的输出结果是【 】。
A.2
B.3
C.4
D.5
以下程序的输出结果是()。 #include <iostream> using namespace std; void main( ) { int a[3][4]={ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23}, (*p)[4]=a; int i, j, k=0; for(i=0; i<3; i++) for(j="0;" j++) k="k+*(*(p+i)+j);"> < <endl;> A、60
B、68
C、99
D、108
有以下程序 #include <stdio.h> #define N 3 void fun( int a[][N], int b[] ) { int i, j; for( i=0; i <n; i++ ) { b[i]="a[i][j];" for( j="1;" j++ if ( a[i][j] } main() int x[n][n]="{1," 2, 3, 4, 5, 6, 7, 8, 9}, y[n] ,i; fun( x, y ); for i="0;" printf( "%d,", y[i] "\n" 程序运行后的输出结果是(> A、3,5,7
B、1,3,5,
C、2,4,8,
D、3,6,9,
有以下程序 #include <stdio.h> void fun(int a[ ], int n) { int i=0; for (i=0; i <n; 2="=" i++) { if (i="0;i<5;" % 0) a[i] +="n;" else -="n;" } main( ) int c[5]="{5,4,3,2,1}," i; fun(c, 5); for printf("%d,", c[i]); printf("\n"); 程序运行后的输出结果是(> A、10,-1,8,-3,6,
B、5,4,3,2,1,
C、10,2,8,4,6,
D、5,-1,3,-3,1,
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!