正在加载图片...
第十章(作业2) 1.下面程序段的输出结果 har*s=“\taOl8bc (;*s!=‘\0’;s++) printf(“*”); 2.下面程序的输出结果是 #include <stdio.h> maino i char a[="Language", b[=Programe k pI=a, p2=b: for(k=0k<=7k++) if(*(p1+k)=*(p2+k) printf("%oc”,(p1+k) 3.下面程序的输出结果是 sub(int x, int y, int *z) maino int a sub(10,5,&a) ub(7,a,&b) sub(a, b, &c) printf(“%4d,%d,%dln”,a,b,c) 4.下面程序的输出结果是 #include <stdio h int f(char *sl, char*s2) i static int nl, n2 while(*s1++)n1++ while( s2++)n2++ uturn nI-n2; i i printf(%d, f(c: \program", \12alt34\n);3 5.以下程序在a数组中査找与ⅹ值相同的元素所在位置。请填空 main i int a[ll, x, i printf(“ Enter l0 integers:n”)第十章(作业 2) 1. 下面程序段的输出结果 char *s=“\ta\018bc”; for(;*s!=‘ \0’;s++) printf(“*”); 2. 下面程序的输出结果是 #include <stdio.h> main() { char a[]=”Language”,b[]=”Programe”; char *p1,*p2; int k; p1=a;p2=b; for(k=0;k<=7;k++) if(*(p1+k)==*(p2+k)) printf(“%c”,*(p1+k)); } 3. 下面程序的输出结果是 sub(int x,int y,int *z) { *z=y-x;} main() { int a,b,c; sub(10,5,&a); sub(7,a,&b); sub(a,b,&c); printf(“%4d,%4d,%4d\n”,a,b,c); } 4. 下面程序的输出结果是 #include <stdio.h> int f(char *s1,char *s2) { static int n1,n2; while(*s1++) n1++; while(*s2++) n2++; ruturn n1-n2; } main() { printf(“%d”,f(“c:\\program”,”\12a\t34\n”)); } 5. 以下程序在 a 数组中查找与 x 值相同的元素所在位置。请填空 main() { int a[11],x,i; printf(“Enter 10 integers:\n”);
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有