#include <iostream>
#include <stack>
using namespace std;
int main()
{
int b,n,e;
cout << "请输入数制转换的进制及数值:"<<endl;
cin >> b >> n;
cout << "数值" << n << "的" << b << "进制为:" << endl;
stack<int>stk;
while (n)
{
stk.push(n%b);
n /= b;
}
while (!stk.empty())
{
cout << stk.top();
stk.pop();
}
return 0;
}
C++标准库之栈(Stack)实现进制转换
最新推荐文章于 2024-04-26 06:30:00 发布