阅读下列程序并回答问题。void funstr(char p[ ], char q[ ],int m){int k = strlen(q);for(;p[m] != '\0'; m++)q[m] = p[m]; /*第4行* /q[m] = '/0';}int main(void){char a[100] = "theVisualc++";char b[100] = "6.0";int m;scanf("%d", &m);funstr(a, b, m);puts(b); return 0;}(1) 程序运行时,输入3,输出();输入5,输出()。(2)将第4行改为“q[m-k] = p[m];”,程序运行时,输入3,输出()。
查看答案
下面程序运行后输入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;}