您当前的位置: 首页 > 

任意进制转换

川川菜鸟 发布时间:2021-05-17 01:45:53 ,浏览量:4

//群:970353786
#include "stdio.h"
#include
using namespace std;
#define StackSize 100
typedef char ElemType;
typedef struct
{
    ElemType data[StackSize];
    int top;
}SqStack;
int trans(int d, int b, char string[])  //string用于存放转换后的字符串
{
    SqStack st;
    char ch;
    int r, i = 0;
    st.top = -1;      // 栈初始化
    if (b  36 || b == 10)  // 2≤b≤36且不为10
    {
        printf_s(" b is Error\n"); return 0;
    }
    while (d != 0)//辗转相除法
    {
        r = d % b; //求余数
        ch = r + (r             
关注
打赏
1688896170
查看更多评论
0.4278s