下列的C++程序使用栈对参数n进行处理后输出,输出的结果是( )。 #include using namespace std; void fun(int n) { stack S; // Say it creates an empty stack S while (n > 0) { // This line pushes the value of n%2 to stack S S.push(n%2); n = n/2; }
// Run while Stack S is not empty while (!S.empty()) { printf("%d ", S.top()); // print it S.pop(); //pop an element from S }