![](https://static.youtibao.com/asksite/comm/h5/images/m_q_title.png)
若有如下程序: include "stdio.h" main() { char s[30]; Strcpy(&S[0],"
若有如下程序: include "stdio.h" main() { char s[30]; Strcpy(&S[0],"adc"); Strcpy(&S[1],"def"); strcpy(&S[2],"gh");; printf("%S\n",s); 则程序运行后的输出结果是【 】。
![](https://static.youtibao.com/asksite/comm/h5/images/solist_ts.png)
若有如下程序: include "stdio.h" main() { char s[30]; Strcpy(&S[0],"adc"); Strcpy(&S[1],"def"); strcpy(&S[2],"gh");; printf("%S\n",s); 则程序运行后的输出结果是【 】。
若有以下程序: #include <iostream> using namespace std; class point { private: int x, y; public: point () { x=0; y=0; } void setpoint(int x1,int y1) { x=x1; y=y1;
A.12,12
B.5,5
C.12,5
D.5,12
若有以下程序:
#include using namespace std ;class Base{public :void Fun() { cout << "1" << endl ;}};class Derived : public Base{public :void Fun() { cout << "2" << endl ; }};int main()
{Derived a;Base * p;p=&a;p-> Fun();a. Fun();return 0;}上面程序的输出结果为:
有如下程序: #include<iostream> using namespace std; Class A { public: A(){cout<<“A”;} ~A(){cout<<“~A”;} }; A*p; public: B(){cout<<“B”;p=new A;} ~B(){cout<<“~B”;delete p;} }; B obj; return 0; ) 执行这个程序的输出结果是(
A.BAA~A~B~A
B.ABA~B~A~A
C.BAA~B~A~A
D.ABA~A~B~A
有如下程序:
#include<iostream>
#include<cstring>
using namespace std;
class XCF{
int a;
public:
XCF(int aa=O):a(aA){cout<<”1”;}
XCF(XCF&X){a=x.a;cout<<”2”;}
~XCF(){cout<<at}
int Geta(){return at}
};
int main(){
XCF dl(5),d2(d1);
XCF半pd=new XCF(8);
cout<<pd->Geta();
delete pd;
return 0;
}
运行时的输出结果是
A.1215588
B.1218855
C.12185
D.128512
有如下程序:
include<iostream>
using namespace std;
class A
{
public:
virtual void f(){cout<<"1";}
};
class B:public A
{
public:
B (){cout<<"2";}
};
class C:public B
{
public:
virtual void f(){B::f();cout<<"3";}
};
int main()
{
A aa,*p;
B bb;
C cc;
p=&cc;
p->f();
return 0;
}
执行上面程序的输出是______。
有如下程序:
#include
using namespace std;
int main()
{
void function(double val);
double val;
function(val);
cout<
return 0;
}
void function(double val)
{
val = 3;
}
编译运行这个程序将出现的情况是
A .编译出错,无法运行
B .输出: 3
C .输出: 3.0
D .输出一个不确定的数
有如下程序: #include <iostream.h> using namespace std; class Demo { public: Demo(){ cout<<"defautt constmctor\n"; } Demo(const Demo &x){cont<<"copy constmctor\n";} }; Demo userCode (Demo b){Demo c(b);return c;} int main() { Demo a,d; cout<<"calling userCode()\n"; d=userCode(a); return 0; } 执行上面程序的过程中,构造函数Demo()和Demo(const Demo&x)被调用的次数分别是()。
A.1和1
B.1和2
C.2和3
D.2和4
若有如下程序: include"stdio.h" main() {char s[30]; strcpy(&s[0],"abc"); strcpy(&s[1],"de"); strcpy(&s[2],"f"); printf("%s\n",s); } 则程序运行后的输出结果是【 】。
有以下程序 include <lostream> using namespace std; int main() { int i=010,j=10; cout<<(i)<<","<<j--<<endl; return 0; } 则该程序运行后的输出结果是【 】。
以下程序输出的结果是()。 #include<iostream> using namespace std; int main() { int **x,*y,z=10; y=&z; x=&y; cout<< **x+1<<endl; return 0; }
A.11
B.x的地址
C.y的地址
D.运行错误