| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 126447 | 涛涛老师 | 十进制转R进制 | C++ | Compile Error | 0 MS | 0 KB | 645 | 2025-07-19 11:27:11 |
char transform_char(int n) { char result; if (n < 10) result = '0' + n; else result = 'A' + (n - 10); return result; } void arbitrary_radix(int n, int radix) { int temp; int remainder; vector<char> result; temp = n; while (1) { if (temp < radix) { result.push_back(transform_char(temp)); break; } remainder = temp % radix; temp = temp/ radix; result.push_back(transform_char(remainder)); } reverse(result.begin(), result.end()); for (int i = 0; i < result.size(); i++) cout << result[i]; } int main() { int n, radix; cin >> n >> radix; arbitrary_radix(n, radix); return 0; }
Main.cc: In function 'void arbitrary_radix(int, int)':
Main.cc:10:2: error: 'vector' was not declared in this scope
vector result;
^
Main.cc:10:9: error: expected primary-expression before 'char'
vector result;
^
Main.cc:14:4: error: 'result' was not declared in this scope
result.push_back(transform_char(temp));
^
Main.cc:19:3: error: 'result' was not declared in this scope
result.push_back(transform_char(remainder));
^
Main.cc:22:10: error: 'result' was not declared in this scope
reverse(result.begin(), result.end());
^
Main.cc:22:38: error: 'reverse' was not declared in this scope
reverse(result.begin(), result.end());
^
Main.cc:24:3: error: 'cout' was not declared in this scope
cout << result[i];
^
Main.cc: In function 'int main()':
Main.cc:31:2: error: 'cin' was not declared in this scope
cin >> n >> radix;
^