#include <iostream> #include<vector> using namespace std; int main() { vector<int>a; int n; while (cin >> n) { if (n == 0)break; int sum = 0; int i = 0; while (n) { sum += (n % 10) * pow(8, i++); n /= 10; } a.push_back(sum); } for (int i = 0; i < a.size(); i++) { cout << a[i] << endl; } }
标签:10,转换,int,sum,++,while,八进制,十进制 From: https://www.cnblogs.com/lhf123/p/17279009.html