十进制转二进制

void conversion()
{
    Stack S;
    int n;
    InitStack(&S);
    printf("Please input a number to convert:
");
    scanf("%d",&n);
    if(n<0)
    {
        printf("The number must be over 0");
        return 0;
    }
    if(n==0)
    {
        Push(&S,n%2);
        n=n/2;
    }
    printf("The result is");
    while(!StackEmpty(&S))
    {
        printf("%d",Pop(&S));
    }
}
原文地址:https://www.cnblogs.com/claudia529/p/11103531.html