十进制转任何进制格式

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int n;
    while (cin >> n) {
        vector<int> res;
        while (n != 0) {
            res.push_back(n % 8);
            n = n / 8;
        }
        for (int i = res.size() - 1; i >= 0; i--) {
            cout << res[i];
        }
        cout << endl;
    }
    return 0;
}