C语言问题,16进制内转任意进制数,转成10进制时的函数对了,但转为任意进制时出错.#include"stdio.h"#include"string.h"#include"math.h"void main(){while(1){int change10(int x,char y[]);int change(int x,int y);int k,l,temp;scan

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/19 01:37:30
C语言问题,16进制内转任意进制数,转成10进制时的函数对了,但转为任意进制时出错.#include
xSN@~Fh׉^xcKb| B 1Bğa]x./b/)-NG(hƦ9w~fw2\;}m7 e]\?go$dP^TqΓۯwPzVG92JV-; ˋy>BmFf .,W NuA\&M]MIŕ ([/+VFCʆ4e4SI(ML3Zc(,bE+ZvjIJOYs۫#sA~5μ? QyA-Qd @6CsT'@8K튉6in* nqzt{潒 % %".

C语言问题,16进制内转任意进制数,转成10进制时的函数对了,但转为任意进制时出错.#include"stdio.h"#include"string.h"#include"math.h"void main(){while(1){int change10(int x,char y[]);int change(int x,int y);int k,l,temp;scan
C语言问题,16进制内转任意进制数,转成10进制时的函数对了,但转为任意进制时出错.
#include"stdio.h"
#include"string.h"
#include"math.h"
void main()
{
while(1)
{
int change10(int x,char y[]);
int change(int x,int y);
int k,l,temp;
scanf("%d",&k);
char st[20];
scanf("%s",st);
temp=change10(k,st);
printf("%d\n",temp);
scanf("%d",&l);
printf("%d\n",change(l,temp));
}
}
int change10(int x,char y[])
{
int i,j;
int sum=0;
for(i=0;i='0'&&y[i]='A'&&y[i]='a'&&y[i]

C语言问题,16进制内转任意进制数,转成10进制时的函数对了,但转为任意进制时出错.#include"stdio.h"#include"string.h"#include"math.h"void main(){while(1){int change10(int x,char y[]);int change(int x,int y);int k,l,temp;scan
最后这句你改一下试试,我没试.
sum+=(y%j)*pow(10,i);
y=y/x;
}
return(sum);
}
====原创回答专用