十進位制轉換成任意進製 c語言

2021-09-07 14:58:23 字數 813 閱讀 4635

今天搞懂了怎麼把十進位制轉換成任意進製,我試了好幾次有時邏輯上沒有錯誤,但是我由於c語言基礎不是太好,所以老是出現一些基礎錯誤。以此來記錄一下我要寫的**,以後繼續銘記。

最近也寫了乙個十進位制轉換任意進製–鏈棧實現

十進位制轉換任意進製,遞迴實現

void

fun(

int n,

int m)

else

}```c

十進位制轉換任意進製,非遞迴實現

```c

const

char f=

"0123456789abcdef"

;void

fun1

(int n,

int m)

while

(i--

)printf

("%c"

,a[i]);

}

總**

#include

#include

#include

const

char f=

"0123456789abcdef"

;void

fun1

(int n,

int m)

while

(i--

)printf

("%c"

,a[i]);

}void

fun(

int n,

int m)

else

}int

main()

任意進製轉換十進位制 c語言

也不算是任意進製,最高只能到十六進製制。見諒!如下 include include include define maxsize 100 靜態順序棧儲存的最大空間 const char f 0123456789abcdef 定義乙個全域性常量 方便匯出十進位制以上的不為數字形式的資料的顯示 void...

BCD轉換成十進位制

bcd碼是指用二進位制來表示十進位制數的編碼,即用4位二進位制來表示一位十進位制數,因此4位二進位制數表示最大的十進位制數9 1001 只取十六個數中的十個數 有別於8421碼 為了表示兩個十進位制數 十位 個位 需要兩個bcd碼 8位 可以用char 型別來儲存,比如 bcd碼 0x99 153 ...

十進位制轉換成其他進製數

十進位制轉換成其他進製數 class trans public static string tobinary int num 十進位制轉換成二進位制數 public static string tooctal int num 十進位制轉換成八進位制數 public static string toh...