进制转换
SJCHEN1221
这个作者很懒,什么都没留下…
展开
-
十进制转二进制(C语言)
算法分析:在实现模2取余后需要逆序输出,这个地方通过不断乘以10,不需要再通过数组或者逆序函数来实现。#include <stdio.h>int Decimal(int n){ int result=0,k=1; int i; while(n){ i=n%2; result = k*i + result; k = k*10; n = n/2; } ...原创 2018-10-02 16:11:38 · 2964 阅读 · 0 评论 -
用顺序表实现十进制转R进制(C语言)
#include <stdio.h>#include <stdlib.h>#define M 100typedef int ElemType;typedef struct { ElemType data[M]; int top;}Stack;//初始化栈void InitStack(Stack *s){ s->top = -1;}in...原创 2018-10-13 15:33:45 · 1228 阅读 · 0 评论 -
十进制转R进制链表(C语言)
#include <stdio.h>#include <stdlib.h>typedef int ElemType;typedef struct Linknode{ ElemType data; struct Linknode *next;}LiStack;//初始化栈void InitStack(LiStack* &s){ ...原创 2018-10-13 15:58:38 · 1222 阅读 · 0 评论 -
用顺序栈实现十进制转二进制(c语言)
#include <stdio.h>#include <stdlib.h>#define M 100typedef int ElemType;typedef struct{ ElemType data[M]; int top;}Stack;//初始化栈void InitStack(Stack *s){ s->top = -1;}int...原创 2018-10-16 17:17:26 · 18704 阅读 · 2 评论