更多"请读程序: # include<stdio.h> f(int b["的相关试题:
[单项选择]请读程序:
#include<stdio.h>
func(int a,int b)
int c;
c=a+b;
return c;
main( )
int x=6,y=7,z=8,r,
r=func((x-,y++,x+y),z-);
printf("%d/n",r);
上面程序的输出结果是_______。
A. 11
B. 20
C. 21
D. 31
[单项选择]请读程序:
#include <stdio.h>
func(int a, int b)
int c;
c=a+b;
return c;
main( )
int x=6,y=7,z=8,r;
r=func((x--,y++,x+y),z--);
printf("%d/n",r);
上面程序的输出结果是( )。
A. 11
B. 20
C. 21
D. 31
[单项选择]请读程序:
# include<stdio.h>
void fun(int * s)
static int j=0;
do
s[j]+=s[j+1]
while( + + j<2);
main( )
int k,a[10]=l,2,3,4,5;
for(k=l;k<3;k+ +)fun(a);
for(k=0;k<5;k++)prinf("%d",a[k]);
上面程序的输出结果是 ( )
A. 34756
B. 23445
C. 35745
D. 12345
[填空题]有以下程序 #include int k = 7; int *st(int *a) { int *c = &k; if(*a > *c) c = a; return c; } main( ) { int i, *p = &i, *r; r = st(p); printf("%d/n", *r); }程序运行后的结果是 [11] 。
[单项选择]有以下程序
#include
int fun(int n, int *p)
int f1, f2;
if(n==1||n==2) *p=1;
else
fun(n-1, &f1); fun(n-2, &f2);
*p=f1+f2;
main( )
int s;
fun(3, &s); printf("%d/n", s);程序的运行结果是()。
A. 2
B. 3
C. 4
D. 5
[填空题]
[程序]
#include
int f(int a,int &b,int *c)
{
a+=b; b+=*c;*c+=a;
return (a+b+*c);
}
void main(void)
{
int x=5,y=5,z=6,sum;
for(int i=0;i<2;i++){
sum=f(x,y,&z);
cout<
}
}
执行程序后输出的第一行是___(1)___,第二行是___(2)___。
[单项选择]有以下程序
#include
int fun(int (*S)[4],int n,int k)
{ int m,i;
m=s[0][k];
for(i=1;im)m=s[i][k];
return m;
}
main( )
{int a[4][4]={{1,2,3,4},{11,12,13,14},{21,22,23,24},{3l,32,33,34}};
printf("%d/n",fun(a,4,0));
}
程序的运行结果是
A. 4
B. 34
C. 31
D. 32
[单项选择]
有以下程序
#include
int f(int t[],int n);
main
{ int a[4]={1,2,3,4},s;
s=f(a,4); printf("%d/n",s);
}
int f(int t[],int n)
{ if(n>0) return t[n-1]+f(t,n-1);
else return 0;
}
程序运行后的输出结果是()
A. 4
B. 10
C. 14
D. 6
[单项选择]
有以下程序
#include
int fun( )
{ static int x=1;
x*2; return x;
}
main( )
{int i,s=1,
for(i=1;i<=2;i++) s=fun( );
printf("%d/n",s);
}
程序运行后的输出结果是()
A. 0
B. 1
C. 4
D. 8
[填空题]
以下程序运行时输出结果是()。
#include
int f(int x,int y)
{retum x+y; }
void main( )
{double a=5.5,b=2.5;
printf("%d",f(a,b));
}
[填空题]
以下程序运行时输出结果是()。
#include
#include
int count(char s[])
{ int i=0;
if(s[i]==’/0’) return 0;
while(isalpha(s[i]))i++;
while(!isalpha(s[i])&&s[i]!=’/O’)i++;
return 1+count(&s[i]);
}
void main( )
{char line[]="one world,one dream.";
printf("%d",count(line));
}
[填空题]有以下程序 #include int fun(int n) { if(n == 0) return(1); return(fun(n - 1) * n); } main( ) { int t; t = fun(3); printf("%d/n", t); }程序运行后输出结果是 [14] 。
[填空题]下面程序的运行结果是______。
#include
int f(int a[],int n)
if(n>1)
return a[0]+f(a+1,n-1);
else
return a[0];main( )
int aa[10]=1,2,3,4,5,6,7,8,9,10,s;
s=f(aa+2,4); printf("%d/n",s);
[填空题]
[程序]
#include
int f2(int *a,int b)
{
*a=*a+b; b=*a+b;
cout<<"*a="<<*a<<"/t"<<"b="<
return *a+b;
}
void f1(int a,int &b)
{
a=a+b;b=a+b;
b=f2(&a,b);
cout<<"a="< }
void main(void)
{
int x=4,y=5;
f1(x,y);
cout<
}
执行以上程序后输出的第一行是(),第二行是(),第三行是()
[填空题]
以下程序运行时输出到屏幕的结果是() 。
#include
int fun(int x)
{static int c,y;
if(c==0) y=1;
else y=y+x;
c++;
return y;
}
void main( )
{int i;
for(i=0;i<2;i++)
printf("%d",fun(2));
}
[填空题]下面程序的运行结果是:【 】。
#include
int f(int a[],int n)
{if(n>1)
return a[0]+f(a+1,n一1);
else
return a[0];
}
main( )
{ int aa[10]={1,2,3,4,5,6,7,8,9,10},S;
S=f(aa+2,4);printf("%d\n",S);
}