栈实现二进制转八进制
数据结构基础:进制转换
相比于二进制转十进制而言,二进制转八进制仅多了一个内层循环用来给新栈填充数值
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
using namespace std;
const int Stack_Init_Size = 20;
const int StackIncrement = 10;
typedef char ElemType;
typedef struct{
ElemType *top;
ElemType *base;
int StackSize;
}sqStack;
void Push(sqStack *s,ElemType e);
void Pop(sqStack *s,ElemType *e);
bool IntiStack(sqStack *s);
int LenStack(sqStack s);
int main()
{
sqStack s,o;
IntiStack(&s);
IntiStack(&o);
ElemType c;
cout <<