#include <iostream>
#include<stack>
using namespace std;
int main()
{
stack<int>s;
int a, b;
cin >> a;
while (a != 0)
{
b = a % 10;
a = a / 10;
s.push(b);
}
while (!s.empty()) {
//输出栈顶元素
cout << s.top()<<" " ;
//弹出栈顶元素
s.pop();
}
return 0;
}
C++ 输出一个数的每一位数
于 2021-11-18 20:57:51 首次发布