I have to write own class for operation on very big numbers. Already have adding:
char index1 = liczba1.length();
char index2 = liczba2.length();
stack<char> wyniki;
while (index1 > 0 || index2 > 0) {
index1--;
index2--;
k = 0;
o = 0;
k = index1 < 0 ? 0 : (liczba1[index1] - 48);
o = index2 < 0 ? 0 : (liczba2[index2] - 48);
wynik = k + o + f;
if (wynik > 9) {
wynik -= 10;
f = 1;
} else {
f = 0;
}
wyniki.push(wynik+48); //
}
short i=0;
if (f > 0){
fin[i++] = f;
}
I throw a stack to reverse the sequence.
do {
fin[i++]= wyniki.top();
wyniki.pop();
} while (!wyniki.empty());
fin[i]=0;
string res(fin);
return DuzaLiczba(res);
}
Now trying to make substraction and comparison of the two numbers. Have any idea how to make substraction?