更多"已知下列程序的输出结果是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
using namespace std;
claSS Foo{
int value;
void setValue(int value)
{【 】=value;//给Foo的数据成员value赋值}
void print( ){cout<
[填空题]已知下列程序的输出结果是23,请将横线处缺失的部分补充完整。
#include<iostream>
using namespace std;
class MyClass
public:
void Print( )constcout<<23;
;
int main( )
MyClass*p=new MyClass( );
______.Print( );
return 0;
[填空题]已知下列程序的输出结果是42,请将横线处缺失的部分补充完整。
#include<iostream>
using namespace std;
class TestClass
int value;
public:
TestClass( ):value(0);
void setValue(int value)
______=value;//给TestClass的数据成员value赋值
void print( )cout<<value;;
;
int main( )
TestClass 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
[填空题]下列程序的输出结果是 【8】 。
#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"
using namespace std;
int Max(int a,int b)
if(a>b)
return a;
else
return b;
void main( )
int m,n;
m=10,n=5;
int max = Max(m,n);
cout<<max<<endl;
A. 10
B. 程序有误
C. 1
D. 0
[单项选择]下列程序的输出结果是
#include <iostream>
using namespace std;
int main ( )
char a[] = "Hello,World":
char*ptr = a;
while (*ptr)
if(*ptr>= ’a’ &&*ptr <=’z’
cout<<char*ptr+’A’-’a’);
else cout<<*ptr;
ptr++;
return 0;
A. HELLO. WORLD
B. Hello, World
C. hELLO, wORLD
D. hello, world
[单项选择]如下程序的输出结果是
#include<iostream>
using namespace std;
class A
public:
virtual void f( )tout<<1;
void g( )cout<<2;
;
class B:public A
public:
virtual void f( )cout<<3;
void g( )cout<<4;
;
void show(A&
A. f( );a.g( );
B. ;
C. 14
D. 32