1 #include"stdio.h"
2 #define MaxSize 50
3 typedef int DataType;
4 typedef struct{
5 DataType elem[MaxSize];
6 int top;
7 }SeqStack;
8 void initStack(SeqStack &s)
9 {
10 s.top = -1;
11 }
12 int push(SeqStack &s , DataType x)
13 {
14 if(s.top == MaxSize -1) return 0;
15 s.elem[++s.top] = x;
16 return 1;
17 }
18 int pop(SeqStack &s , DataType &x)
19 {
20 if(s.top == -1) return 0;
21 x = s.elem[s.top--];
22 return 1;
23 }
24 main()
25 {
26 int x;
27 int n;
28 int r;
29 SeqStack s;
30 initStack(s);
31 scanf("%d",&n);
32 r = n%2;
33 while(n!=0 &&push(s , r))
34 {
35 n = n/2;
36 r = n%2;
37 }
38 while(pop(s , x))
39 {
40 printf("%d",x);
41 }
42 }