남은코드있는데..이건 문제될것같아서못올림 내가짠거긴함

add 가이드라인잡아둬서 곱셈이나 나눗셈 뺄셈은 알아서들 만들어쓰고 속도는 꾀빠름..


#include <iostream>
#include <string>
#include <stack>

using namespace std;

class BigBoy{
public:
    string num;
    BigBoy* Add(BigBoy* b);
    BigBoy(){}
    BigBoy(string n){
        num = n;
    }
};

BigBoy* BigBoy::Add(BigBoy* b)    // BIG Int 덧셈
{
    BigBoy* reVal;
    char ground = '0';
    char max = '9';
    char up = 0;
    char atom;
    int size1, size2,i;
    size1 = num.size() - 1;
    size2 = b->num.size() - 1;
    stack<char> charStack;
   
    if (size1 > size2){
        for (i = size1; i > 0; i--){
            atom = num[i] + b->num[i - 1] + up - ground;
            up = 0;
            if (atom > max){
                up = 1;
                atom -= 10;
            }
            charStack.push(atom);
        }
        if (up == 1){
            atom = num[0] + 1;
            if (atom > max){
                atom -= 10;
                charStack.push('0');
                charStack.push('1');
            }
            else
                charStack.push(atom);
        }
        else
            charStack.push(num[0]);
    }
    else{
        for (i = size1; i >= 0; i--){
            atom = num[i] + b->num[i] + up - ground;
            up = 0;
            if (atom > max){
                up = 1;
                atom -= 10;
            }
            charStack.push(atom);
        }
        if (up == 1)
            charStack.push('1');
    }
   
    string calcResult(charStack.size(),' ');
    i = 0;
    while (!charStack.empty())
    {       
        calcResult[i++] = (char)charStack.top();
        charStack.pop();
    }
    reVal = new BigBoy(calcResult);

    return reVal;
}