//10进制转换为2进制#includeusing namespace std;struct Node{ int data; Node*next;};struct LinkStack{ Node*top;};LinkStack*create(){ LinkStack*stack = new LinkStack; stack->top = NULL; return stack;}bool isEmpty(LinkStack*stack){ return (stack->top == NULL);}void pop(LinkStack*stack){ if (!isEmpty(stack)) { Node*p = stack->top; stack->top = stack->top->next; delete p; }}void push(LinkStack*stack, int item){ Node*p = new Node; p->data = item; p->next = stack->top; stack->top = p;}void top(LinkStack*stack){ cout << stack->top->data;}int main(){ int n; cin >> n; LinkStack*stack = create(); while (n / 2 != 0) { push(stack, n % 2); n = n / 2; } push(stack, n); while (!isEmpty(stack)) { top(stack); pop(stack); } cout << endl; delete stack; return 0;}