入门模拟——(进制转换)B1022.D进制的A+B

#include <bits/stdc++.h>
#include<math.h>
using namespace std;
const int MAX_LEN = 100005;
const int MAX_D = 31;
int main(){
    int a,b,n;
    cin>>a;
    cin>>b;
    int temp = a+b;
    cin>>n;
    int result[MAX_D];
    int num = 0;
    do{
        result[num++] = temp % n;
        temp =  temp / n;
    }while(temp != 0);12 12 
    for(int i = num-1;i>=0;--i){
        cout<<result[i];
    }
    system("pause");
    return 0;
} 
原文地址:https://www.cnblogs.com/JasonPeng1/p/12129531.html