c++ 80分求助 急救 在线等!!!
查看原帖
c++ 80分求助 急救 在线等!!!
1020317
xyc713713楼主2023/11/23 19:34

80分 啊啊啊!!! 我的代码

#include<bits/stdc++.h>
using namespace std;
string intToA(int n,int m){
    string ans="";
    do{	
        int t=n%m;
        if(t>=0&&t<=9)    
			ans+=(t+'0');
        else 
			ans+=(t+'a'-10);
        n/=m;
    }while(n);   
    reverse(ans.begin(),ans.end());
    return ans;    
}
int main(){
	int n,m;
	cin>>n>>m;
	cout<<intToA(n,m);
	return 0;
}
谁能救救我    
`啊啊啊啊啊`
2023/11/23 19:34
加载中...