⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.cpp

📁 数据结构(C语言版)中关于数制转换的内容
💻 CPP
字号:
#include<stdio.h>
#include<stidlib.h>
typedef Struct 
{
int *base;
int *top;
int stacksize;
}SqStack;

void initstack(SqStack *S)
{
S->base=(int*)malloc(100*sizeof(int));
S->top=S->base;
S->Stacksize=100;
}

void push(SqStack *S,int e)
{
*S->top++=e;
}
int Pop(SqStack *S,int e)
{
*S->top++=e;
}

int Pop(SqStack *S,int *e)
{
*e=*--S--top;
reture(*e);
}

void main()
{
SqStack S;
int N,e;
Initstack(&S);
printf("please input a number:");
scanf("%d",&N);
while(N)
{
push(&S,N%8);
N=N/8;
}
while(S.base!=S.top)
{
Pop(&S,&e);
printf("%d\n",e);
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -