字符串str由数字字符组成(长度不超过5个字符),可看作任意进制的数,请补充函数fun(),该函数的功能
字符串str由数字字符组成(长度不超过5个字符),可看作任意进制的数,请补充函数fun(),该函数的功能是:把 str字符串转换成任意进制的数,结果保存在数组xx中,由函数返回转换后数组腆的实际长度。其中x表示str原来的进制, y表示要转换成的进制。例如,输入str=“1111”,x=2,y=10,结果输出:15。如果输入str=“15”, x=10,Y=2,结果输出: 1111。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include <stdio.h>include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
试题程序:include <stdio.h>include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
include <stdio.h>include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
include<stdlib.h>include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
include<string.h>define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
define N 8int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int xx[N];int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int fun(char *str,int x,int y){int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int sum;int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int i=0;char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
char *p=str;for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
for(i=0; i<N; i++)xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
xx[i]=0;sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
sum=*p-'0';p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
p++;while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
while (*p){sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
sum=【 】;p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
p++;}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
}i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
i=0;while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
while(sum!=0){xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
xx[i]=【 】;【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
【 】;i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
i++;}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
}return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
return i;}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
}main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
main (){char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
char str[6];int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int i;int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int n;int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int x;int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
int y;printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("Enter a string made up of '0' to'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
'9' digits character:");gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
gets(str);if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
if(strlen (str) >5){printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("Error:string too longer!,please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
please input again!\n\n");exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
exit(0);}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
}for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
for(i=0;str[i];i++)if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
if(str[i]<'0'||str[i]>'9'){printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
{printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("Error:%c not is '0' to'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
'9' digits character!\n\n",str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
str[i]);exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
exit(0);}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
}printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("The original string: ");puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
puts(str);printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("\nINPUT x= ");scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
scanf("%d",&x);printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("\nINPUT y= ");scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
scanf("%d",&y);n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
n=fun(str,x,y);printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("\n%s is convered to",str);for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
for (i=n-1; i>=0; i--)printf("%d",xx[i]);}
printf("%d",xx[i]);}
}
点击查看答案