mam klase BigInt która w tablicy tupuy char przechowuje duze liczby, nastepnie chce przeladowac operator "+" aby móc dodawac obiekty owej klasy:
klasa:
class BigInt{
char cyf[1000];
int dl;
public:
BigInt(){dl=1;cyf[0]=0;}
BigInt(char *);
void operator+(BigInt &a);
bool BigInt::operator==(BigInt &a);
bool BigInt::operator!=(BigInt &a);
bool BigInt::operator<(BigInt &a);
void BigInt::add(BigInt b);
int less(BigInt );
void show();
};
nastepnie moja funkcja:
void BigInt::operator+( BigInt &a)
{
while(dl<a.dl)cyf[dl++]=0;
int r=a.dl;
while(r<dl)cyf[r++]=0;
r=0;
for(int i=0;i<dl;i++){
cyf[i]+=a.cyf[i]+r;
r=cyf[i]/10;
cyf[i]%=10;
}
if(r>0)cyf[dl++]=r;
}
nastepnie wywolanuie w main:
BigInt a("5438768958486759895895480987595874");
BigInt b("53453454354354363566779");
a+b;
a.show();
i nie wiem czemu ale dostaje znaki typu serduszka, pieski, koleczka i tego typu dziwaczne rzeczy;/ funkcja "show" to petla for ktora wypiwuje cala liczbe;
bardzo prosilbym o pomoc.