输入hello↙,写出下面程序的运行结果。 #include <stdio.h> #include <string.h> int main() { char s[80],t[200]; int i,sl ; gets(s); sl = strlen(s); for(i=0 ;i<sl ;i++) t[i]=s[sl-i-1] ; for (i=0; i<sl; i++) t[sl+i] = s[i]; t[sl+i]='0' ; puts(t); return 0; }

输入hello↙,写出下面程序的运行结果。 #include <stdio.h> #include <string.h> int main() { char s[80],t[200]; int i,sl ; gets(s); sl = strlen(s); for(i=0 ;i<sl ;i++) t[i]=s[sl-i-1] ; for (i=0; i<sl; i++) t[sl+i] = s[i]; t[sl+i]='0' ; puts(t); return 0; }


参考答案和解析
ollehhello

相关考题:

以下程序的输出结果是 【 11 】 。#include stdio.hint fun(int x){ static int t=0;return(t+=x);}main(){ int s,i;for(i=1;i=5;i++) s=fun(i);printf("%d\n",s);}

有以下程序:includeincludevoid fun(char s[][10],int n){char t;int i,j; 有以下程序: #include<stdio.h> #include<string.h> void fun(char s[][10],int n) { char t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) /*比较字符串的首字符大小,并交换字符串的首字符*/ if(s[i][0]>s[j][0]){t=s[i][0];s[i][0]=s[j][0];sEj][0]=t;} } main() {char s[5][10]={"bcc","bbcc","xy","aaaacc","aabcc"); fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.xcc,aabccD.acc,xabcc

下面程序的运行结果是()。includevoid del(char*s){int i,j;char *a;a=s;for(i=0,j=0;a 下面程序的运行结果是( )。 #include<stdio.h> void del(char*s) { int i,j; char *a; a=s; for(i=0,j=0;a[i]!='\0';i++) { if(a[i]>='0'a[i]<='9') { s[j]=a[i]; j++; } s[j]='\0'; }} main() {char s[]="aa89gggh"; del(s); printf("\n%s",s); }A.aaB.89C.ggghD.aa89gggh

有下列程序: include include "string.h" void tim(char *s[],int n) 有下列程序: #include <stdio.h> #include "string.h" void tim(char *s[],int n) { char *t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]=s[j];s[j]=t;} } main() { char *ss[]= {"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下面程序的运行结果是includevoid delch(char*s){int i,j;char *a;a=S;for(i=0,j=0;a[ 下面程序的运行结果是 #include<stdio.h> void delch(char *s) { int i,j; char *a; a=S; for(i=0,j=0;a[i]!='\0';i++) if(a[i]>='0' aa[i]<='9') {s[j]=a[i]; j++;} s[j]='\0';} main() { char *item="a34bC"; delch(item); printf("\A.abcB.34C.a34D.a34bc

有以下程序#include stdio.h#include string.hvoid fun(char *s[],int n){ char *t; int i,j;for(i=0;in-1;i++)for(j=i+1;jn;j++)if(strlen(s[i])strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;}}main(){ char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"};fun(ss,5); printf("%s,%s\n",ss[0],ss[4]);}程序的运行结果是A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下列给定程序中,函数fun()的功能是:删除字符串s中所有空白字符(包括Tab字符、回车符及换行符)。输入字符串时用’’结束输入。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构.试题程序:include <string.h>include <stdio.h>include <ctype.h>fun(char *p){ int !i, t; char c[80];for(i=0,t=0;p[i];i++)if(!isspace(*(p+i))) c[t++]=p[i];/**********************************/c[t]='\0';strcpy(p,c);}main(){char c,s[80];int i=0;printf("Input a string: ");c=getchar();while(c!='')( s[i]=c;i++;c=getchar();}s[i]="\0";fun(s);puts(s);}

下列给定程序中函数fun()的功能是;先将在字符串s中的字符按逆序存放到t串中,然后把s中的字符按正序连接到t串的后面。例如:当s中的字符串为ABCDE时,则t中的字符串应为EDCBAABCDE。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio.h>include <stdio.h>include <string.h>void fun (char *s, char *t ){int i,sl;sl=strlen(s);for (i=0;i<sl;i++)t[i]=s[sl-1];for (i=0; i<sl; i++)/*************found**************t [sl+i]=s [i];t [2*sl]-'\0';}main ( ){ char s[100], t[100];clrscr();printf("\nPlease enter string s: ");scanf ("%s", s);fun (s,t);printf ("The result is: %s\n",t);}

下面程序的运行结果是( )。include define SlZE 12 main() {char s[SIZE];int i;for(i=0 下面程序的运行结果是( )。include<stdio.h>define SlZE 12main(){char s[SIZE];int i;for(i=0;i<SIZE;i++) s[i]='A'+i+32;sub(s,5,SIZE-1);for(i=0;i<SIZE;i++)printf("%c",s[i]);printf("\n");}sub(char *a,int t1,int t2){ char ch;while(t1<t2){ ch=*(a+t1);*(a+t1)=*(a+t2);*(a+t2)=ch;t1++;t2--;}}

已知C源程序如下: include include void reverse(char S[]){ int C,i,J; f 已知C源程序如下:include<stdio. h>include<string. h>void reverse(char S[]){int C,i,J;for(i=0,j=strlen(s)-1;i<j;i++,j++){c=s[i];s[i]=s[j];s[j]=c;}}void getHex(int number,char s[]){int I;i=0;while(number>0){if(number%16<10)s[i++]=number%16+'0';elseswitch(number%16){case 10:s[i++]='A';break;case 11:s[i++]='B';break;case 12:s[i++]='C';break;case 13:s[i++]='D';break;case 14:s[i++]='E';break;case 15:s[i++]='F';break;default:printf("Error");break;}number/=16;}s[i]:'\o';reverse(s);}int main(){unsigned int number;int i=0:char s[50];printf("%s","please input number;\n");scanf("%d",&number):getHex(number,s);i=0;while(s[i])printf("%c",s[i++]);return 0;}画出程序中所有函数的控制流程图。

有以下程序 include include void fun(char s[][10],int n 有以下程序 #include <stdio.h> #include <string.h> void fun(char s[][10],int n) { char t; int i j; for (i=0; i<n-1; i++) for 0--i+l; j<n; j++) /*比较字符串的首字符大小,并交换字符串的首字符*/ if(s[i][0] > s[j][0]) { t = s[i][0]; s[i][0] = s[j][0]; s[j][0] = t;} } main() { char ss[5][10]= {"bcc", "bbcc", "xy", "aaaacc", "aabcc" }; fun(ss, 5); printf("%s,%s\n", ss[0],ss[4]); } 程序的运行结果是A.xy, aaaaccB.aaaacc,xyC.xcc,aabccD.acc,xabcc

若有以下程序:include using namespace std;int f(){static int i = 0;int s = 1;s+= 若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; int s = 1; s+=i; i++; return s; } int main() { int i,a = 0; for(i = 0;i<5;i++) a+=f(); cout<<a<<endl; return 0; } 程序运行后,输出的结果是A.20B.24C.25D.15

以下程序运行后的输出结果是()。includevoid reverse(int a[],int n){int i,t;for(i=0; 以下程序运行后的输出结果是( )。 #include<stdio.h> void reverse(int a[],int n) {int i,t; for(i=0;i<n/2;i++) {t==a[i];a[i]=a[n-1-i];a[n-1-i]=t;} } main() {int b[10]={10,9,8,7,6,5,4,3,2,1};int i,s=0; reverse(b,10); for(i=0;i<3;i++)s+=b[i]; printf("%d\n",s); }A.27B.6C.25D.30

以下程序的输出结果是【 】。include int fun(int x) {static int t=0; return(t+=x); } 以下程序的输出结果是【 】。include <stdio.h>int fun(int x){ static int t=0;return(t+=x);}main()int s,i;for(i=1 ;i<=5;i++) s=fun(i);printf("%d\n",s);

有以下程序:includeincludevoid fun(char*s[],int n){char*t;int i,j;for( 有以下程序: #include<stdio.h> #include<string.h> void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { Char*ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

设有下列程序: include include main() { int i; char si 10],ti 10]; gets( 设有下列程序:include<stdio.h>include<string.h>main(){ int i;char si 10],ti 10];gets(t);for(i=0;i<2;i++){ gets(s);if(strcmp(t,s)<0)strcpy(t,s);}printf("%s\n",t);}程序运行后,从键盘上输入(<CR>代表回车符):CDEF<CR>BADEF<CR>QTHRG<CR>,则程序的输出结果是______。

有以下程序includeincludevoidfun(char*s[],intn){char*t;int i,j;for(i=0 有以下程序 #include <stdio.h> #include <string.h> void fun(char *s[],int n) { char *t; int i,j; for(i=0;i<n-1;++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i];s[j];s[j]=t;} } main() { char *ss[]={"bccA.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下面程序的运行结果是includemain(){char a[]="morning",t; int i,j=0; for(i=1;i 下面程序的运行结果是 #include<stdio.h> main() { char a[]="morning",t; int i,j=0; for(i=1;i<7;i++) if(a[j]<a[i])j=i; t=a[j]; a[j]=a[7]; a[7]=a[j]; puts[a];}A.mrgninrB.moC.moringD.morning

以下程序的输出结果是()。includevoid reverse(int a [],int n){int i,t; for(i=0;i 以下程序的输出结果是( )。 #include <stdio.h> void reverse(int a [],int n) { int i,t; for(i=0;i<n/2;i++) { t=a[i]; a[i]=a[n-1 -i];a[n-1-i] =t;} } main() { int b[10]={1,2,3,4,5,6,7,8,9,10};int i,s=0; reverse(b,8); for(i=6;i<10;i++)s+=b[i]; printf("%d\n",s); }A.22B.10C.34D.30

已知C源程序如下:/ * longIntAdd * /include stdio. hinclude string. hdefine LENGTH 81void addLInt(char sl[],char s2[]); void reverse(char s[]) ; int main(){char intstrl[LENGTH],intstr2[LENGTH];printf("请输入超长整数的被加数和加数:\n")scanf("%s%s" ,intstrl ,intstr2) ; addLInt(intstrl ,intstr2) j printf("超长整数和为: %s" .intstrl); return 0;}void addLInt(char sl[] ,char s2[]) {int i=0,tmp,c=0;char s[LENGTH];if(strlen(s1)strlen(s2)){ strcpy(s,sl); strcpy(sl,s2); strcpy(s2,s);}reverse(sl);reverse(s2);while(s2[i]! ='\0'){tmp=sl[i]-'0'+s2[i]-'0'+ c;sl[i] = tmp%10+,0';c=tmp/10;i++; } while(sl[i]! ='\0,c){tmp=sl[i] —'0' + c;sl[i] = tmp%10+'0';c=tmp/10;i++; } If(c){sl[i++] = c+'0';sl[i] = '\0'; } reverse(sl);}void reverse(cliar s[]){inti,j,c;for(i=0,j = strlen(s) -l;ij;i++,j--){c=s[i]; s[i] = s[j]; s[j] = c; } }(1)画出程序中函数addLInt的控制流程图(10分);(2)设计一组测试用例,使该程序addLInt函数的语句覆盖率和分支覆盖率均能达到100%。如果认为该函数的语句覆盖率或分支覆盖率无法达到100%,需说明为什么(10分)。

有以下程序includevoid main(){char s[]={"01aXy"};int i,n=0;for(i=0;s[i]!=0;i++)if 有以下程序 #include<stdio.h> void main() { char s[]={"01aXy"};int i,n=0; for(i=0;s[i]!=0;i++) if(s[i]<='a's[i]>='z')n++; printf("%d\n",n); } 程序运行后的输出结果是( )。A.0B.2C.3D.5

有以下程序:includeinclude"string.h"void fun(char*s[],int n){char*t;int i,j;for( 有以下程序: #include<stdio.h> #include"string.h" void fun(char*s[],int n) { char*t;int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])){t=s[i];s[i]=s[j];s[j]=t;} } main() { char*ss[]={"bee","bbcc","xy","aaaacc","aabcc"}; fun(ss,5);printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是( )。A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下列给定程序中,函数fun()的功能是将字符串s中位于偶数位置的字符或ASCII码为奇数的字符放入字符串t中(规定第一个字符放在第0位中)。例如:字符串中的数据为ADFESHDI,则输出应当是 AFESDI。请改正程序中的错误,使它能得到正确结果。注意;不要改动main函数,不得增行或删行,也不得更改程序的结构。试题程序:include <conio.h>include <stdio.h>include <string.h>define N 80/************found*************/void fun(char s,char t[]){int i,j=0;for(i=0;i<strlen(s);i++)/*********found*+************/if(i%2=0 || s[i]%2!=0)t[j++]=s[i];t[j]='\0';}main(){char s[N],t[N];clrscr();printf("\nPlease enter string s:");gets(s);fun(s,t);printf("\nThe result is:%s\n",t);}

请选出以下程序的输出结果_______。 includesub(int*s,inty){ static int t=3,y=s[t];t 请选出以下程序的输出结果_______。 #include<stdio.h> sub(int*s,inty) { static int t=3, y=s[t];t-; } main() { int a[]={1,2,3,4},i,x=0; for(i=0;i<4;i++){ sub(a,x);printf("%d",x);} printf("\n"); }A.1234B.4321C.0D.4444

有以下程序includeincludevoidfun(char,*s[],intn){char*t;inti,j; for(i= 有以下程序 #include <stdio.h> #include <string.h> void fun(char,*s[],int n) { char *t; int i,j; for(i=0;i<n-1;i++) for(j=i+1;j<n;j++) if(strlen(s[i])>strlen(s[j])) {t=s[i];s[i]:s[j];s[j]=t;} } main() { char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s\n",ss[0],ss[4]); } 程序的运行结果是A.xy,aaaaccB.aaaacc,xyC.bcc,aabccD.aabcc,bcc

下面程序的运行结果是()。includevoid delch(char *s){ int i,j;char*a;a=s;for(i=0,j= 下面程序的运行结果是( )。 #include<stdio.h> void delch(char *s) { int i,j; char*a; a=s; for(i=0,j=0;a[i]!='\0' ;i++) if(a[i]>='0' a[i]<='9') { s[j]=a[i]; j++;} s[j]='\0'; } main() { char*item="a34bc"; delch(item); printf("\n%s" ,item);}A.abcB.34C.a34D.a34bc

单选题有以下程序:#include #include void fun(char *s[],int n){ char *t; int i,j; for(i=0;i  for(j=i+1;j   if(strlen(s[i])strlen(s[j]))   {    t=s[i];    s[i]=s[j];    s[j]=t;   }}main(){ char *ss[]={"bcc","bbcc","xy","aaaacc","aabcc"}; fun(ss,5); printf("%s,%s",ss[0],ss[4]);}程序的运行结果是(  )。Axy,aaaaccBaaaacc,xyCbcc,aabccDaabcc,bcc

单选题有以下程序#include int f(int n){ int t=0,a=5; if(n/2) {  int a=6;  t+=a++; } else {  int a=7;  t+=a++; } return t+a++;}main(){ int s=0,i=0; for(;i2;i++)s+=f(i); printf(%d,s);}程序运行后的输出结果是(  )。A36B28C32D24