标签:class 转换 == get c语言 stack printf main return
#include<stdio.h> #include<stdlib.h> typedef struct SqStack { int data[100]; int top; }SqStack; void Push(SqStack* S, int e) { S->top++; S->data[S->top] = e; } void Pop(SqStack* S, int* e) { *e = S->data[S->top]; S->top--; } int Empty(SqStack* S) { return S->top == -1; } void Init(SqStack* S) { S->top = -1; } //非负十进制整数转八进制,打印输出 void conversion(unsigned int num) { SqStack S; Init(&S); while (num != 0) { Push(&S, num % 8); num = num / 8; } while (!Empty(&S)) { int e; Pop(&S, &e); printf("%d", e); } } void main() { unsigned int num = 100; conversion(num); getchar(); }
标签:class 转换 == get c语言 stack printf main return
原文地址:https://www.cnblogs.com/wumingoo1/p/11167713.html