十进制转八进制C++源代码(2)
发布时间:2021-06-06
发布时间:2021-06-06
十进制转八进制C++源代码
boolStackEmpty(SqStack *S)
{
if (S->top - S->base == 0)
{return 1;}
else
{
return 0;
};
};
void conversion ()
{
SqStack S;
int N, e;
InitStack(&S);
printf ( "Please input the num\n");
scanf ("%d",&N);
while (N)
{
Push(&S, N % 8);
N = N/8;
};
while (!StackEmpty(&S))
{
Pop(&S, &e);
printf ( "%d", e );
};
printf ( "\n");
} // conversion
void main()
{
conversion();
}