更多"下面程序的输出结果是 #include<iostream.h> #"的相关试题:
[单项选择]下面程序的输出结果是( )。
#include
#include
voidmain()
{
charp1[10],p2[10];
strcpy(p1,"abc");
strcpy(p2,"ABC");
charstr[50]="xyz":
strcpy(str+2,strcat(p1,p2));
cout< }
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC
[单项选择]下面程序输出的结果是( )。
#include<iostream>
using namespace std;
int fuc (char *x);
int main( )
cout<<fuc("hello")<<endl;
return 0;
int fuc(char *x)
char *y=x;
while(*y! =’/0’)y++;
return(y-x);
A. 5
B. 6
C. 0
D. 语法错误,不能输出结果
[单项选择]下面程序的输出结果是( )。
#include
Usingnamespacestd;
ClassBase{
public:
Base(intx=O){count< }
};
ClassDerived:publicBase{
public:Derved(intx=0{count< }
private;
Baseval;
};
intmina(){
Derivedd(1);
retrun0;
}
A. 0
B. 1
C. 01
D. 001
[单项选择]下面程序输出的结果是
#include<iostream.h>
void main( )
inti;
int a[3] [3] =1,2,3,4,5,6,7,8,91;
for(i=0;i<3;i++)
cout < < a[2-i] [i] < < " "; A) 1 5 9 B) 7 5 3 C) 3 5 7 D) 5 9 1
[填空题]下面程序输出的结果是 【11】 。
#include <iostream>
using namespacc std;
class A {
public:
void show( ){tout<<"A!";}
};
class B: public A{
public:
virtual void show( ){cout<<"B!";}
};
class C: public B{
public:
virtual void show( ){cout<<"C!";}
};
void show_info(A *i){i->show( );}
void main( ){
A ia;B ib;C ic;show_info(&ia); show_info(&ib);show_info(&ic);
}
[填空题]下面程序输出的结果是 【10】 。
#include <iostream>
using namespace std;
class A {
public:
virtual void show( ) {cout<<"A!";
};
class B: public A {
public:
void show( ) {cout << "B!";}
};
class C: public B{
public:
void show( ){cout << "C!";}
};
void show_info(A &i) {i. show( );}
void main( ) {
A ia; B ib; C ic; show_info(ia);show_info(ib); show_info(ic); }
[填空题]下面程序输出的结果是
【11】 。
#include <iostream>
using namespacc std;
class A
public:
void show( )tout<<"A!";
;
class B: public A
public:
virtual void show( )cout<<"B!";
;
class C: public B
public:
virtual void show( )cout<<"C!";
;
void show_info(A *i)i->show( );
void main( )
A ia;B ib;C ic;show_info(&i
- a); show_info(&i
- b);show_info(&i
- c);
[填空题]下面程序输出的结果是
【10】 。
#include <iostream>
using namespace std;
class A
public:
virtual void show( ) cout<<"A!";
;
class B: public A
public:
void show( ) cout << "B!";
;
class C: public B
public:
void show( )cout << "C!";
;
void show_info(A &i) i. show( );
void main( )
A ia; B ib; C ic; show_info(i
- a);show_info(i
- b); show_info(i
- c);
[单项选择]下面程序的输出结果是
#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
[单项选择]下面程序的输出结果是( )。
#include<iostream>
#include<string>
using namespace std;
void main( )
charp1[10],p2[10];
strcpy(p1,"abc");
strcpy(p2,"ABC");
charstr[50]="xyz";
strcpy(str+2,strcat(p1,p2));
cout<<str;
A. xyabcABC
B. yzabcABC
C. xyzabcABC
D. zabcABC
[单项选择]下面程序的输出结果是( )。
#include<iostream>
#include<math.h>
using namespace std;
class point
private:
double x;
double y;
public:
point(double a,double b)
x=a;
y=b;
friend double distances(point a,point b);
;
double distances(point a,point b)
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
int main( )
point p1(1,2);
point p2(5,2);
cout<<distances(p1,p2)<<end1;
return 0;
A. 2
B. 4
C. 8
D. 16
[填空题]下面程序的输出结果是 【15】 。
#include <iostream.h>
#include <math.h>
class point
{
double x;
double y;
public:
point(double a, double b)
{
x=a;
y=b;
}
friend double distance(point a, point b) ;
};
double distance(point a, point b)
{
return sqrt ((a. x-b.x) * (a. x-b.x)+ (a. y-b. y) * (a. y-b. y) );
}
void main( )
{
point p1(1,2);
point p2(5,2);
cout<<distance(p1,p2)<<end1;
}