写出以下程序的运行结果。#include int fun(int a){int b=0;static int c=3;b ; c ;return(a
写出以下程序的运行结果。
#include int fun(int a){int b=0;static int c=3;b ; c ;return(a b c);}
main(){int i, a=5;for (i=0; i<3; i )cout<< i<< " "<< fun(a)<< " ";}
写出以下程序的运行结果。
#include int fun(int a){int b=0;static int c=3;b ; c ;return(a b c);}
main(){int i, a=5;for (i=0; i<3; i )cout<< i<< " "<< fun(a)<< " ";}
第1题
写出程序的运行结果。
#include
main()
{int a, b;
scanf ("%d%d", &a, &b);
if (a>=h) printf("Yes");
printf (" a+h =%d\n", a+h );
}
如果输入:a=6,b=8,则输出结果是___________
第2题
写出程序的输出结果。
#include
main()
{ìntk=lO; char c="b"';
do
swith(c++)
{ case'a':k++;
case'b':k--;
case'c' :k+=3;break;
case'd',:k=k%4;
}
while(c! ='c');
printf("%d\n",k );
}
运行结果是:____________
第3题
如果输入1、2、3、4,则以下程序的运行结果为【 】。 include <stdio.h> main() { char c; int i,k; k=0; for (i=0;i<4;i++) { while(1) { c=getchar(); if(c>=0&&c<=9) break; } k=k*10+c-0; } printf("k=%d\n",k); }
第4题
以下程序的运行结果为【 】。 include <stdio.h> main() { static int b[2][3]={{1,2,3},{4,5,6}}; static int *pb[]={b[0],b[1]}; int i,j; i=0; for (j=0;j<3;j++) printf("b[%d][%d]=%d ",i,j,*(pb[i]+j)); printf("\n"); }
第5题
有以下程序 include<stdio.h> yoidmain() { chars[]:{012xy};inti,n=0; for(i=0;s[i]!=0;i++) if(s[i]>=a&&s[i]<==Z)n++; printf(%d\n,n); } 程序运行后的输出结果
A.0
B.3
C.5
D.2
第6题
设有以下程序 include<stdio.h> main() { int n1,n2; scanf("%d",&n2); while(n2!=0) {n1=n2%10; n2=n2/10; printf("%d",n1); } } 程序运行后,从键盘上输入1186,则输出结果为______。
第7题
写出以下程序运行的结果。
main()
{char cl='a',c2='b',c3='c',c4='\101',c5='\116';
printf("a%cb%c\tc%c\tabc\n",c1,c2,c3):
printf("\t\b%c%c",c4,c5):
}
第8题
第9题
若输入I have a test.,则以下程序的运行结果为【 】。 include<stdio.h> main() { FILE*fp; char str[100],filename[10]; int i=0; if ((fp=fopen("test","w"))==NULL) { printf("can not open the file!\n"); exit(0); } getchar(); gets(str); while(str[i]!=) { if (str[i]>=a && str[i]<=z) str[i]=str[i]-32; fputc(str[i],fp); i++; } fclose(fp); fp=fopen("test","r"); fgets(str,strlen(str)+1,fp); printf("%s\n",str); fclose(fp); }
第10题
第11题
请写出以下程序的运行结果
#define MAX(a , b , c)
((a)>(b)?((a)>(c)?(a):(c)): ((b)>(c)?(b): (c)))
main()
{ int x , y , z ;
x=1;y=2;z=3
printf(“%d,”,MAX(x , y , z));
printf(“%d,”,MAX(x+y , y , y+x));
printf(“%d\n”,MAX(x , y+z , z)); }
运行结果: