题目内容

下面程序运行后输入g,输出是()。int main(void){int i;char s[ ] = "programming!", ch;printf("%d\t",sizeof(s));ch = getchar( ) ;for(i = 0; i < strlen(s); i++){if(s[i] == ch) { strcpy(s, s+i); puts(s); break; }}return 0;}

查看答案
更多问题

以下程序的功能是将无符号八进制数字构成的字符串转换为十进制整数。例如输入的字符串为556,则输出十进制整数366.请填空。int main(void){char *p, s[6];int n;p = s; gets(p);n = *p-'0';while(() != '\0') n = n*8 + *p - '0';printf("%d\n", n); return 0;}

以下程序的输出结果是( )。int main(void){char a[ ] = "123456789", *p = a; int i = 0;while( *p ){if( i % 2 == 0 ) *p = '*';p++; i++;}puts(a); return 0;}

以下程序运行后输入“3, abcde<回车>”,则输出结果是( ) 。void move(char *str, int n){char temp; int i;temp = str[n-1];for( i = n-1; i > 0; i--) str[i] = str[i-1];str[0] = temp;}int main(void){char s[50]; int n, i,,z;scanf("%d,%s", &n,s);z = strlen(a);for(i = 1; i <= n; i++) move(s, z);printf("%s\n",s); return 0;}

下面程序的输出结果是( )。int f(char c, char *s){int m, n, h;for(n = 0, h =strlen(s); n <= h; ){m = (n+h) / 2;if(c < s[m] ) h = m-1;else if(c >s[m]) n = m + 1;else return m;}return -1;}int main(void){printf("%d“,f('g',"abdgkmxy"));printf("%d \n",f('C', "BQMAXYZOTE"));return 0;}

答案查题题库