
有下列程序: #include <stdio.h> void fun(char *a, char *B) { while(*a=='*')a++; while(*b=*A) {b++;a++;} } main() { char *s="*****a*b****",t[80]; fun(s,t);puts(t); 程序的运行结果是()。
A.*****a*b
B.a*b
C.a*b****
D.ab

A.*****a*b
B.a*b
C.a*b****
D.ab
第1题
有下列程序,在横线添加; #include<iostream> using namespace std; class TestClass { public: TestClass (int n){number=n;} ______//拷贝构造函数 ~TestClass(){} private: int number; }; TestClass fun(TestClass p) { TestClass temp(P); return temp; } int main() { TestClsss obj1(10),obj2(0); TestClass obj3(obj1); obj2=fun(obj3); return 0; }
A.TestClass(TestClass &other){number=other.number;}
B.TestClass(TestClass other){number=other.number;}
C.TestClass(TestClass &other){number;}
D.TestClass(&other){number=other.number;}
第2题
有下列程序,功能是把输入的十进制长整型数以十六进制的形式输出,完成程序
#include "stdio.h"
main()
{char b[17]={"0123456789ABCDEF"};
int c[50],d,i=0,base=16;
long n;
scanf("%ld",&n);
do{c[i]=n%base;i++;n= 【14】 ;}
while(n!=0);
for(--i;i>=0;--i)
{d= 【15】 ;printf("%c",b[d]);}
printf("H\n");}
第3题
有如下程序: #include<iostream> using namespace std; int main() { cout.fill('*') cout.width(6); cout.fill('#') cout<<123<<endl; return 0; } 执行后的输出结果是
A.###123
B.123###
C.***123
D.123***
第4题
有如下程序: #include<iostream> using namespqce Std; class TestClass { private; Char C; public; TestClass(char n):c(n){} ~TestClass() { cout<<c; }; class TestClassl:public TestClass { private: Char C; public:
A.xy
B.yx
C.x
D.y
第5题
下列程序的输出结果是()。 #include<iostream> using namespace std; int main() { char a[]="Hello,Test"; char *p=a; while(*p) { if(*p>='a'&&*p<='z') cout<<char(*p+'A'-'a'); else cout<<*p; p++; } return 0; }
A.hello,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
第6题
有如下程序: #include<iostream.h> using namespace std; Class Base { public: Base(){cout<<“BB”;f();} void{(){cout<<“BF”;} }; class Derived:public Base { public: Derived(){cout<<“DD”;} void f(){cout<<“Df”;) }; int main
A.BBBfDD
B.BBDfDDDf
C.DD
D.DDBBBf
第7题
有如下程序: #include<iostream> using namespace std; Class TestClass { private: int x,y; public: TestClass(int i,int j) { x=i; y=j; } void print() { cout<<“print1”<<endl; } void print()const { cout<<”prin
A.printl
B.print2
C.printl print2
D.程序编译时出错。
第8题
下列程序的输出结果是()。 #include<iostream> using namespace std; int main() 于 chara[]=”Hello,Test”; Char*p=a; while(*p) { if(*p)=’a’&&*p(=’z’) cout<<char(*p+’A’-’a’); else cout<<*p; p++; } return 0; }
A.hello,test
B.Hello,Test
C.HELLO,TEST
D.hELLO,tEST
第9题
有如下程序: #include<iostream> using namespace std; classA{ public: virtua1 voidfunc1(){cout<<“A1”;} voidfunc2(){cout<<“A2”;}}; class B:publicA{ public: void funcl(){cout<<“B1”;} void func2(){cout<<“B2”;}}; intmain(){ A*p=ne
A.B1B2
B.A1A2
C.B1A2
D.A1B2
第10题
有以下程序: #include<iostream> using namespace std; #definePl 3.14 Class Point {private: int x,y; public: Point(int a,intB) {X=a; y:b;} int getx() <return x;} int gety() {return y;}}; class Circle:public Point {pri
A.314
B.157
C.78.5
D.153.86