有以下程序 #include<stdio.h> intfun(int a,intB){if(b=0)return a; else return(fun(--a,--B)); } main() {pdntf("%d\n",fun(4,2));} 程序的运行结果是( )。
A.1
B.2
C.3
D.4
第1题:
有以下程序 #include<iostream> using namespace std; int a; int fun(); int main() { extern int a; int b; a=100; b=fun(); cout<<b<<endl; return 0; } int fun() { extern int a; return(10*a); } 其程序运行后的输出结果是( )。
A.100
B.10
C.1000
D.10000
第2题:
有以下程序: #include<stdio.h> int fun(int*k) {int b=0; b=*k+b: return(B);} main() {int a[10]={1,2,3,4,5,6,7,8},i; for(i=2;i<4;i++){printf("%d",fun(&a[i]));} printf("\n"); } 程序运行后的输出结果是( )。
A.10 12
B.8 10
C.3 4
D.10 28
第3题:
有以下程序: #include<stdio.h> int fun(int x,int y) {if(x==y)return(x); else return((x+y)/2); } main() {int a=1,b=2,c=3; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。
A.2
B.3
C.4
D.5
第4题:
有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。
A.0
B.10
C.20
D.出错
第5题:
有以下程序 #include <stdio.h> int fun(int a, int b) { if(b==0) return a; else return(fun(-a,-b)); } main() { printf("%d\n",fun(4,2)); } 程序的运行结果是______。
A.1
B.2
C.3
D.4
第6题:
有以下程序: #include<stdioh> int fun(int x,int y) {if(x!=y)return(y); else return((x+y)/2); } main() {int a=4,b=5,c=6; printf("%d\n",fun(2*a,fun(b,C))); } 程序运行后的输出结果是( )。
A.3
B.6
C.8
D.12
第7题:
有以下程序: #include<iostream> using namespace std; int a; int fun(); int main() { externint a; int b; a=10; b=fun(); cout<<b<<end1; return 0; } int fun() { extern int a; return(10*a); } 其程序运行后的输出结果是( )。
A.10
B.1
C.100
D.1000
第8题:
有以下程序: #include <iostream> using namespace Std; int a; int fun(); int main() { extern int a; int b; a = 100; b = fun(); cout<<b<<end1; return 0; } int fun() { extern int a; return (10*A); } 其程序运行后的输出结果是( )。
A.100
B.10
C.1000
D.10000
第9题:
有以下程序: #include <stdio.h> fun(int a, int b) { if(a>b) return(a); else return(b); } main() { int x=3,y=8,z=6,r; r=fun(fun(x,y),2*z); printf("%d\n",r); } 程序运行后的输出结果是( )。
A.3
B.6
C.8
D.12