更多"已知下列程序的输出结果是42, 请将画线处缺失的部分补充完整。 #in"的相关试题:
[填空题]已知如下程序的输出结果是23,请将画线处缺失的部分补充完整。
#include<iostream>
using namespace std;
class MyClass
public:
void Print( )consteout<<23;
;
int main( )
MyClass*P=new MyClass( );
______.Print( );
return 0;
[填空题]已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class Foo
int value;
public:
Foo( ):value(0)
void setValue(int value)
______=value;//给Foo的数据成员value赋值
void print( ) cout<<value;
;
int main( )
Foo f;
f.setValue(42);
f.print( );
retum 0;
[填空题]已知下列程序的输出结果是42,请将画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class Foo {
int value;
public:
Foo 0=:value(0) {}
void setValue(int value)
{ 【10】 = value; }//给Foo的数据成员value赋值
void print( ) { cout << value; }
};
int main( )
{
Foo f;
f.setValue(42);
f.print( );
return( );
}
[填空题]已知如下程序的输出结果是23,请将画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class MyClass {
public:
void Print( ) const { cout << 23; }
};
int main( ) {
MyClass* p = new MyClass( );
【9】 .Print( );
return 0;
}
[填空题]已知下列程序的输出结果是42,请将下画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class Foo
int value;
public:
Foo( ):value(0)
void setValue(int value)
______=value;//给Foo的数据成员value赋值
void print( )eout<<value;
;
int main( )
Foo f;
f.setValue(42);
f.print( );
return 0;
[填空题]已知下列程序的输出结果是42,请将下画线处缺失的部分补充完整。
#include <iostream>
using namespace std;
class Foo{
int value;
public:
Foo( ):value(0){}
void setValue(int value)
{______=value;}//给Foo的数据成员value赋值
void print( ){eout<<value;}
};
int main( ){
Foo f;
f.setValue(42);
f.print( );
return 0;
}
[单项选择]如下程序的输出结果是
#include<iostream>
#include<iomanip>
using namespace std;
class CSum
int x,y;
public:
CSum(int x0,int y0):X(x0),y(y0)
friend ostream& operator<<(ostream& os,const CSum& xA)
os<<setw(5)<<xa.x+xa.y:
return os;
;
int main( )
CSum y(3,5);
cout<<setfill('*')<<8;
cout<<y;
return 0;
A. 88
B. ****88
C. ****8****8
D. 8****8
[单项选择]如下程序的输出结果是 #include<iostream> #include<cstring> using namespace std; class XCF{ int a; public: XCF(int aa=0):a(aA) {cout<<"1";} XCF(XCF&X){a=x.a;cout<<"2";l ~XCF( ){cout<<a;} int Geta( )t return a;} }; int main( ){ XCF d(15),d2(d1); XCF*pd=new XCF(8); cout<<pd->Geta( ); delete pd; return 0; }
A. 1215588
B. 1218855
C. 12185
D. 128512
[填空题]下列程序的输出结果是 【9】 。
#include<iostream>
#include<cstring>
using namespace std;
void fun(const char*s,char &c) {c=s[strlen(s)/2];}
int main( )
{
char str[]="ABCDE";
char ch=str[1];
fun(str, ch);
cout<<ch;
return 0;
[填空题]以下程序的输出结果是 [9] 。
include<iostream.h>
include <string.h>
void main 0
char s[50];
strcpy(&s[O], "No" );
strcpy(&s[1], "123" );
strcpy (&s[2], "23456" );
cout<<s;
[单项选择]下面程序的输出结果是 #include<iostream.h> #include<string.h> void main( ) { char p1[10],p2[10] strcpy(p1,"abc"); strcpy(p2,"ABC"); char str[50]="xyz"; strcpy(str+2,strcat(p1,p2)); cout<<str; }
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]下面程序的输出结果是
#include<iostream.h>
#include<string.h>
void main( )
char p1[10],p2[10]
strcpy(p1,"abc");
strcpy(p2,"ABC");
char str[50]="xyz";
strcpy(str+2,strcat(p1,p2));
cout<<str;
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[填空题]己知下列程序的输出结果是42,请将横线处缺失的部分补充完整。
#include<iostream>
using namespace std;
class Foo{
int value;
public:
Foo( ):value(0){}
void setValue(int value)
{______=value; //给Foo的数据成员value赋值}
void print( ){cout<<value;}
};
int main( )
{
Foo f;
f.setValue(42);
f.print( );
return 0;
}
[单项选择]以下程序的输出结果是( )。
#include<iostream>
#include<stdlib>
using namespace std;
void func(char **m)
++m;
cout<<*m<<endl;
main( )
static char *a[]="MORNING","AFTERNOON","EVENING");
char **n;
n=a;
func(n);
system("PAUSE");
return 0;
A. 为空
B. MORNING
C. AFTERNOON
D. EVENING