At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
using namespace std;
//This program will test three functions capable of reading, adding,
//and printing 100-digit numbers.
// Do not change these function prototypes:
void addBig(int, int, int);
// This constant should be 100 when the program is finished.
const int MAX_DIGITS = 100;
//There should be no changes made to the main program when you turn it in.
// Declare the three numbers, the first, second and the sum:
int num1[MAX_DIGITS], num2[MAX_DIGITS], sum[MAX_DIGITS];
bool done = false;
cout << "Please enter a number up to "< >response;
done = toupper(response)=='N';
void readBig(int x)
int length, i, oneLess, l;
need help finishing the addBig and printBig functions
If I understand your addBig() function, you are taking the number from the same index out of each array, adding them, then storing it in a third array. So you will have a for loop where you have array3[i] = array2[i] + array1[i]; and presumably you will do something with it there since you are neither passing by reference or returning a value.
@eSpeX would i start it out like inti; for(i=0;i
Assuming MAX_DIGITS is the size of your array, yes. You want your index to step through each element of your array.
well this is what the code is supposed to do Write functions for doing arithmetic on 100-digit integers. Include functions for input, output, and addition. The input function should not print anything. The addition function should do no reading or printing. No function should make any assumptions about how the other functions or main program work. The number of digits should be in a global constant. The function prototypes should be as follows: void readBig(int) void addBig(int,int,int) void printBig(int)
I see where you are getting an integer from the user, what are you doing if that number isn't as big as 100 digits?
well my teacher wrote us the main function and told us not to change it, he wants us to add the three add, print, and read functions
Did your teacher also write the readBig() method or is that something you created?
i wrote the readBig function
The same loop you use for setting the values of the array is the same method you will use to step through the addition. You just have two arrays and a temp, so you will need to create a temp and then loop through saying that temp[i] = x[i] + y[i]; you will need to add some error handling in the event the two numbers go over 10 so you can carry it on to the next iteration.