情编程,实现“多”进制间的转换~~~~~~~~~~~
历史上最急的求援!请编写程序,实现进制间的转换(二进制转十进制,八进制转十进制,十进制转二、八进制)现只差函数部分,请指教!(*小数部分也要注意到啊~)BQ TO D 二、八转十,
D TO BQ 十转二、八:
#include <stdio.h>
void dtobq()
{
};
bqtod()
{
};
main()
{
char mb[80],*mp;
int mc,mn,mib[80],mfb[80];
float b,d,q;
for(; ;)
{
printf(" menu ");
printf("~~~~~~~~~~~~~~");
printf("1 B-->D ");
printf("2 Q-->D ");
printf("3 D-->B ");
printf("4 D-->Q ");
printf("0 Exit ");
printf("~~~~~~~~~~~~~~");
printf("your choce is:");
scanf("%d",&mc);printf("\n");
switch(mc)
{
case 0:break;
case 1:
{
printf("please input binary:");
mp=mb;
scanf("%s",mp);d=bqtod(mp,2);printf("\n");
printf("%sB-->",mp);
printf("%fD\n",d);break;
}
case 2:
{
printf("please input octal:");
mp=mb;
scanf("%s",mp);
d=bqtod(mp,8);
printf("\n");
printf("%sQ-->",mp);
printf("%fD\n",d);break;
}
case 3:
{
printf("please input a Decimal:");
scanf("%f",&d);printf("\n");
dtobq(d,2);break;
}
case 4:
{
printf("please input a Decimal:");
printf("\n");
scanf("%f",&d);printf("\n");
dtobq(d,8);break;
}
}
if(mc==0) break;
}
}
这是用Turbo C 2.0 编写的程序,请您把未完成的函数告诉小弟就行啦,本人将不
胜感激,诚心求援~!!!555~~~~
[此贴子已经被作者于2004-06-21 22:17:15编辑过]