如下程序的输出是什么? #include <stdio.h> void Swap (int x, int y);int main() { int x = 1; int y = 2; printf ("x=%d,y=%d\n", x, y); Swap (x, y); printf ("x=%d,y=%d", x, y); } void Swap (int x, int y) { int temp; temp = x; x = y; y = temp; printf ("x=%d,y=%d\n", x, y); }? x=1,y=2x=2,y=1x=2,y=1|x=1,y=2x=1,y=2x=2,y=1|x=1,y=2x=2,y=1x=1,y=2|x=1,y=2x=1,y=2x=1,y=2
举一反三
- 如下程序的输出是什么? #include [stdio.h] void Swap (int x, int y); int main() { int x = 1; int y = 2; printf ("x=%d,y=%d\n", x, y); Swap (x, y); printf ("x=%d,y=%d", x, y); } void Swap (int x, int y) { int temp; temp = x; x = y; y = temp; printf ("x=%d,y=%d\n", x, y); } A: x=1,y=2x=2,y=1x=2,y=1 B: x=1,y=2x=1,y=2x=2,y=1 C: x=1,y=2x=2,y=1x=1,y=2 D: x=1,y=2x=1,y=2x=1,y=2
- 以下程序的输出结果是( )。main(){ int x=1,y=2; void swap(int x,int y); swap(x,y); printf("x=%d,y=%d\n",x,y);}void swap(int x,int y){ x=3,y=4;} A: x=3,y=4 B: x=1,y=2 C: x=3 y=4 D: x=1 y=2
- int x = 3,y = 4;以下哪条输出语句正确? A: Console.WriteLine("x={x},y={y}", x,y); B: Console.WriteLine("x={x},y={y}"); C: Console.WriteLine("x={0},y={1}", x,y); D: Console.WriteLine("x={1},y={2}", x,y);
- int main()执行结果是(){int x=2,y=1; switch(x) { case 1: y=x ; break; case 2: y=-x ; case 3: y=x*3 ; break; case 4: y=4*x; } printf(“%d\n”,y);}
- 以下程序的运行结果是_____________ #include "stdio.h" void main() { void add(int x,int y, int z); int x=2,y=3,z=0; printf("(1)x=%d y=%d z=%d\n",x,y,z); add(x,y,z); printf("(3)x=%d y=%d z=%d\n",x,y,z); } void add(int x,int y, int z) { z=x+y; x=x*x; y=y*y; printf("(2)x=%d y=%d z=%d\n",x,y,z); }