编辑代码

#include "stdio.h"
#include "seqstack.h"
void d_to_o(unsigned x)
{ SEQSTACK stack, *s;
s=&stack;
Init_Stack(s);
while(x!=0)
{ Push_Stack(s,x%8);
x=x/8
}
while(!Stack_Empty(s))
{ printf("%4d",Gettop_Stack(s));
Pop_Stack(s);
}
}
main()
{ unsiqned x=150;
d_to_o(x);
}
void shizhuaner(int y)
{
    SEQSTACK s;
    Init_Stack(&s);
    while (y > 0)
    {
        Push_Stack(&s, y % 8);
        y /= 8;
    }
    while (!Stack_Empty(&s))
    {
        printf("%d", Pop_Stack(&s));
    }
    printf("\n");
}

int main() {
    int n;
    printf("输入一个十进制数:");
    scanf("%d", &n);
    printf("对应的八进制为:");
    shizhuaner(n);
    return 0;
}