文章
19
粉丝
69
获赞
30
访问
18.0k
使用STL容器vector存储八进制串
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
vector<int> newbase;
while (n != 0)
{
int remainder = n % 8;
newbase.push_back(remainder);
n /= 8;
}
for (auto it = newbase.rbegin(); it != newbase.rend(); it++)
{
cout << *it;
}
cout << endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发