|  | 
 
| 
#include <stdio.h>
x
马上注册,结交更多好友,享用更多功能^_^您需要 登录 才可以下载或查看,没有账号?立即注册  #include <stdlib.h>
 typedef int ElemType;
 #define M
 typedef struct
 {
 ElemType elem[M];
 int top;
 }Seqstack;
 void Init(Seqstack *s)//初始化;
 {
 s=(Seqstack *)malloc(sizeof(Seqstack));//定义栈空间;
 s->top=-1;
 }
 void Push (Seqstack *s,ElemType e)
 {
 
 if (s->top==M-1) exit(0);
 s->top++;
 s->top=e;
 }
 int Pop(Seqstack *s,ElemType e)
 {
 if (s->top==-1) return 0;
 e=--(s->top);
 
 printf ("%d ",e);
 }
 int main()
 {
 
 int n,i,e;
 Seqstack s;
 Init (&s);
 //Empty(s);
 printf ("请输入十进制数 :");
 scanf ("%d",&n);
 while (n)//int型;
 {
 Push(&s,n%8);
 n =        n/8;
 }
 
 printf ("输出八进制数 :");
 while(s.top!=-1)
 
 {
 Pop(&s,e);
 
 printf ("%d ",e);
 }
 
 return 0;
 }
 
 
你这程序是十进制转8进制,十进制转8进制 复制代码#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    printf("%o",n);
    return 0;
}
就可以了 | 
 |