Ok so here is a snippet of the code my question is how do i return the value i am adding two int array together inside this method at least this is where i think it should happen. it has been over a year sense any programming classes first one back so any light on the subject wold be great,I am still pretty new at this so explicit explanation would be great,thanks
[code][code]
BigInt BigInt::add(const BigInt& rightOperand) const {
BigInt objToReturn;
//Do add logic here
( this is where i have my array of ints adding )
I dont know why this code below is here except for explanation of the two arrays??
//num1 is the this object
cout << this->numArr[99];
//num2 is the rightOperand object
cout << rightOperand.numArr[99]; when I am done how do i return my temp_arr to the oobjToReturn?
return objToReturn;
this was code that was given to us by the instructor, I realize the array dose not print out like it is. but how do I get my int array to load into the object to get it to return??? coder777 it is a const on the out side to protect the num array being passed in right or am I thinking wrong???
what you need to do is assign this to objToReturn:
objToReturn = *this;
to perform the addition you might store each digit in its own field of the array.
You need another variable that tells how many digits are stored.
I suggest that you store the least significant digit first.
so use a loop to add each field. if > 9 -> carry to next field