str是一个由数字和字母字符组成的字符串,由变量num传入字符串长度。请补充函数proc(),该函数的功能是:把字符串str中的数字字符转换成数字并存放到整型数组bb中,函数返回数组bb的长度。 例如,str="abc123de45fg67",结果为:1234567。 注意:部分源程序给出如下。 请勿改动main()函数和其他函数中的任何内容,仅在函数proc()的横线上填入所编写的若干表达式或语句。 试题程序: #include<stdio.h> #define M 80 int bb[M]; int proc(char str[], int bb[], int num) { int i, n=0; for(i=0; i<num; i++) { if(______) { bb[n]=______; n++; } } return ______; } void main() { char str[M]; int num=0, n, i; printf("Enter a string:n"); gets(str); while(str[num]) num++; n=proc(str, bb, num); printf("\nbb="); for(i=0; i<n; i++) printf("%d", bb[i]); }
查看答案
有以下程序: #include<stdio.h> #define f(x)x*x*X main() { int a=3, s, t; s=f(a+1); t=f((a+1)); printf("%d, %d\n", s, t); } 程序运行后的输出结果是______。
A. 10,64
B. 10,10
C. 64,10
D. 64,64
有以下程序: #included<stdio.h> main() {char s[]={"012xy"}; int i, n=0; for(i=0; s[i]!=0; i++) if(s[i]>="a"&&s[i]<="z")n++; printf("%d\n", n); } 程序运行后的输出结果是______。
A. 0
B. 2
C. 3
D. 5
有以下程序: #include<stdio.h> #include<string.h> main() {char str[][20][{"One*World", "One*Dream!"}, *p=str[1]; prinft("%d, ", strlen(p)); printf("%s\n", p); } 程序运行后的输出结果是______。
A. 9, One*World
B. 9, One*Dream!
C. 10, One*Dream!
D. 10, One*World
以下叙述中正确的是______。
A. 程序设计的任务就是编写程序代码并上机调试
B. 程序设计的八种就是确定所用数据结构
C. 程序设计的任务就是确定所用算法
D. 以上三种说法都不完整