若有宏定义如下: #define X 5 #define Y X+1 #define Z Y*X/2以下程序段的输出结果是______。 int a;a=Y; printf("%d\n",Z); printf("%d\n",--a);
A.7 6
B.12 6
C.12 5
D.7 5
第1题:
以下程序执行后的输出结果是( )。 #include<iostream> using namespace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y, int z,int r) { z = x+y; X = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第2题:
以下程序执行后的输出结果是 #include<iostream> using namcspace std; void try(int,int,int,int); int main() { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第3题:
以下程序执行后的输出结果是 #include <iostream> using namespace std; void try(int,int,int,int); int main () { int x,y,z,r; x =1 ; y = 2; try(x,y,z,r); cout<<r<<endl; return 0; } void try(int x,int y,int z,int r) { z = x+y; x = x*x; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第4题:
若有以下程序段; #include<iostream> using namespace std; int main() { int a[]={1,4,5}; int *p=&a[0],x=6,y,z; for(y=0;y<3;y++) z=((*(p+y)<x) ? *(p+y):x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。
A.1
B.4
C.5
D.2
第5题:
以下程序执行后的输出结果是( )。 #include <iostream> using namespace std; void try(int,int,int,int); int main ( ) { int x,y,z,r; x=1; y=2; try(x,y,z,r); cout<<r<<end1; return 0; } void try(int x,int y, int z,int r) { z = x+y; x = X*X; y = y*y; r = z+x+y; }
A.18
B.9
C.10
D.不确定
第6题:
若有以下程序段: #include <iostream> using namespace std; int main () { int a[]={1,4,5}; int *p=&a[0],x=6, y,z; for (y=0; y<3; y++) z= ( (* (p+y) <x) ? *(p+y) :x); cout<<z<<end1; return 0; } 程序运行后的输出结果是( )。
A.1
B.4
C.5
D.2
第7题:
设有如下宏定义
define MYSWAP(z,x,y){z=x;x=Y;Y=z;}
以下程序段通过宏调用实现变量a、b内容的交换,请填空。
float a=5,b=16,c;
MYSWAP( 【 】,a,b) ;
第8题:
设有如下宏定义
#define MYSWAP(z,x,y)
{z=x;x=y;y=z;}
以下程序段通过宏调用实现变量a,b内容交换,请填空。
float a=5,b=16,c;
MYSWAP(( ),a,b);
第9题:
有如下程序段:
intx=1,y=2,z=3;
x=x^z:
y=y^z;
z=x^y:
cout<<x<<y<<z;
这个程序段的输出结果是______。