正在加载图片...
第二部分¢语言程序设计同步训练 205 2.有如下函数调用语句 该函数调用语句中,含有的实参个数是 3.下面add函数的功能是求两个参数的和,并将和值返回调用函数。函数中错误的部 分是 改后为 void add(float a, float b) Float c 阅读程序写出执行结果 1.以下程序的运行结果是 int max (int x int y)i fint a=l, b=2,Ci printf("max is d\n",c) max(int x, int y) return(z) 以下程序的运行结果是 maln incx(); I int x=O printf("x=d\n",++x) 四、程序填空 1.函数 gongyu的作用是求整数numl和num2的最大公约数,并返回该值,请填空。 [temp=numl; numl=num2; num2=temp; 1第二部分 C 语言程序设计同步训练 ·205· ·205· 2. 有如下函数调用语句: func(rec1,rec2+rec3,(rec4||rec5)); 该函数调用语句中,含有的实参个数是 。 3. 下面 add 函数的功能是求两个参数的和,并将和值返回调用函数。函数中错误的部 分是 ,改后为 。 void add(float a,float b) {float c; c=a+b; return c; } 三、阅读程序写出执行结果 1. 以下程序的运行结果是( )。 #include<stdio.h> int max (int x int y); main() {int a=1,b=2,c; c=max(a,b); printf("max is %d\n",c); } max(int x,int y) {int x; z=(x>y)?x:y; return(z); } 2. 以下程序的运行结果是( )。 int incx(); main() {incx(); incx(); incx(); } incx() { int x=0; printf("x=%d\n",++x); } 四、程序填空 1. 函数 gongyu 的作用是求整数 num1 和 num2 的最大公约数,并返回该值,请填空。 gongyu(int num1,int num2) {int temp,a,b; if(num1( _) num2) {temp=num1;num1=num2;num2=temp;} a=num1;b=num2; while(_ ) {temp=a%b;a=b;b=temp;}
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有