Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
70153 李琥博 十进制转R进制 C++ Compile Error 0 MS 0 KB 379 2024-04-13 17:28:12

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; char s[105]; int main(){ int n,r,o,i=0; cin>>n>>r; if(n<0){ cout<<-; n=-n; } while(n!=0){ o=n%r; n=n/r; if(o<=9){ s[i++]=o+'0'; }else{ s[i++]='A'+o-10; } } for(int j=0;j<n;j++){ cout<<s[n-1-i]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:10: error: expected primary-expression before ';' token
   cout<<-;
          ^