anonymous
  • anonymous
need help finishing a code
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
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.
katieb
  • katieb
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
#include #include 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 readBig(int[]); void printBig(int[]); 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. int main() { // Declare the three numbers, the first, second and the sum: int num1[MAX_DIGITS], num2[MAX_DIGITS], sum[MAX_DIGITS]; bool done = false; char response; while (!done) { cout << "Please enter a number up to "<>response; cin.ignore(900,'\n'); done = toupper(response)=='N'; } return 0; } void readBig(int x[]) { int length, i, oneLess, l; string number; getline(cin,number); length=number.length(); l=length-1; oneLess=MAX_DIGITS-1; for(i=0;i
anonymous
  • anonymous
need help finishing the addBig and printBig functions
eSpeX
  • eSpeX
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
@eSpeX would i start it out like inti; for(i=0;i
eSpeX
  • eSpeX
Assuming MAX_DIGITS is the size of your array, yes. You want your index to step through each element of your array.
anonymous
  • anonymous
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[])
eSpeX
  • eSpeX
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?
anonymous
  • anonymous
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
eSpeX
  • eSpeX
Did your teacher also write the readBig() method or is that something you created?
anonymous
  • anonymous
i wrote the readBig function
eSpeX
  • eSpeX
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.