Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
1080 | 张宸瑞 | 进制转换2 | C++ | Compile Error | 0 MS | 0 KB | 594 | 2023-07-01 15:22:16 |
#include <cmath> using namespace std; string s; char zhuanhuan(int a) { if(a<=9&&a>=0){ return a+'0'; } if(a>=10&&a<=36){ return a+'A'-10; } } int a(int x) { int n=0,max=1; for(int i=s.size()-1;i>=0;i--){ n+=(s[i]-'0')*max; max=max*10; } return n; } int main() { int n,m,x,i=0,j=0; cin>>n>>m; cin>>s; char b[100]; x=a(n); while(x) { b[i]=zhuanhuan(x%m); x=x/m; i++; } for(j=i-1;j>=0;j--){ cout<<b[j]; } return 0; }
Main.cc:3:1: error: 'string' does not name a type string s; ^ Main.cc: In function 'int a(int)': Main.cc:17:15: error: 's' was not declared in this scope for(int i=s.size()-1;i>=0;i--){ ^ Main.cc: In function 'int main()': Main.cc:26:5: error: 'cin' was not declared in this scope cin>>n>>m; ^ Main.cc:27:10: error: 's' was not declared in this scope cin>>s; ^ Main.cc:37:9: error: 'cout' was not declared in this scope cout<b[j]; ^ Main.cc: In function 'char zhuanhuan(int)': Main.cc:13:1: warning: control reaches end of non-void function [-Wreturn-type] } ^