更多"下面程序的输出结果是( )。 #include<iostream."的相关试题:
[单项选择]下面程序的输出结果是 #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"
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<stdio.h> try1( ) static int x=3; x++; return(x), void main( ) int i, x; x=try1( ); printf("%d/n", x);
A. 3
B. 4
C. 5
D. 6
[单项选择]下列程序的输出结果是() #inClUde<iostream> using namespace std; intmain( ) { Char a[]="HellO,World"; Char*ptr=a; while(*ptr) { if(*ptr>=’a’&& *ptr <=’Z’) cout<<char(*ptr+’A’ -’a’); else cout<<*ptr; ptr++; } retur0; }
A. HELLO,WORLD
B. Hello,world
C. hELLO,wORLD
D. hellO,world
[单项选择]下面程序输出的结果是( )。
#include <iostream>
using namespace std;
void swap(int &a,int &b)
int temp;
temp=a;
a=b;
b=temp;
void main( )
int x=2;
int y=3;
swap(x,y);
cout<<x<<y;
A. 23
B. 32
C. ab
D. ba
[单项选择]下面程序输出的结果是( )。 #include<iostream> using namespace std; int test(int n1,int n2) {return n1 +n2;} float test (int f1,float f2){return f1-f2;} float test(float x,float y){return(x+y)/2;} float test(float x,int y){return(x+y)*2;} void main( ){ int a1=10; float a2=2.5f; cout<<test(a1,a2); }
A. 12.5
B. 7.5
C. 6.25
D. 25
[单项选择]以下程序的输出结果是( )。
#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
[单项选择]下面程序输出的结果是
#include<iostream.h>
void main( )
int i;
int a[3][3]=1,2,3,4,5,6,7,8,9;
for(i=0;<3;i++)
cout<<a[2-i][i]<<" ";
A. 1 5 9
B. 7 5 3
C. 3 5 7
D. 5 91
[单项选择]下面程序的输出结果是
#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
[单项选择]下面程序输出的结果是( )。
#include<stdio.h>
main( )
char *a="1234";
fun(a);
printf("/n");
fun(char *s)
char t;
if(*s)
t=*S++;fun(s);
else return;
if(t!='/0')
putchar(t);
A. 1234
B. 4321
C. 1324
D. 4231
[单项选择]下面程序的输出结果是
#include <stdio.h>
#include <string.h>
main( )
char p1[20]="abc",*p2="ABC", str[50]="xyz";
strcpy(str+2,strcat(p1,p2));
printf("%s/n",str);
A. xyzabcABC
B. zabcABC
C. xyabcABC
D. yzabcABC