9-10
不会 不懂呜呜呜
#include<stdio.h>
void to_base_n(unsigned long a,int b);
int main()
{
unsigned long a;
int b;
int count;
printf("请输入要转化的十进制整数:");
while(scanf("%ul",&a)==1)
{
printf("请输入要转化的进制数(2-10):");
while((count=scanf("%d",&b)==1) &&b<=10&&b>=2)//这个条件是啥用
{
printf("这句有啥用?");
}
if(count!=1)//count是干啥的?
break;
printf("转化的数字为:");
to_base_n(a,b);
putchar('\n');
printf("请输入要转化的十进制整数(q退出):");
}
printf("bye!");
return 0;
}
void to_base_n(unsigned long a,int b)
{
int r;
r=a%b;
if(a>=b)
to_base_n(a/b,b);
putchar(r);
return;
}
6万+

被折叠的 条评论
为什么被折叠?



