13: bigNumber.cpp) 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 []) Use the main program provided to test the functions.
Addition of Two Numbers
Adding two numbers in programming is essentially the same as adding two numbers in general arithmetic. A significant difference is that in programming, you need to pay attention to the data type of the variable that will hold the sum of two numbers.
C++
C++ is a general-purpose hybrid language, which supports both OOPs and procedural language designed and developed by Bjarne Stroustrup. It began in 1979 as “C with Classes” at Bell Labs and first appeared in the year 1985 as C++. It is the superset of C programming language, because it uses most of the C code syntax. Due to its hybrid functionality, it used to develop embedded systems, operating systems, web browser, GUI and video games.
Please code using C++ and only use the header <iostream>. The use of any additional headers will not be accepted. Thank you!
![**Task 13: bigNumber.cpp**
**Objective:**
Write functions for performing arithmetic on 100-digit integers. These functions should handle input, output, and addition operations.
**Requirements:**
- The input function should be silent and not produce any output.
- The addition function should not involve any input or output operations.
- Functions should not assume any specifics about other functions or the main program structure.
- The number of digits should be defined as a global constant.
**Function Prototypes:**
```cpp
void readBig(int[])
void addBig(int[], int[], int[])
void printBig(int[])
```
Use the provided main program to test these functions.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f71a40a-4cff-4959-8946-a68dc332c184%2F8cd3eca5-bdba-4e5b-84b6-8291e71aac3a%2Fnwu9ov_processed.jpeg&w=3840&q=75)
![```cpp
#include <iostream>
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 (not done)
{
cout << "Please enter a number up to " << MAX_DIGITS << " digits: ";
readBig(num1);
cout << "Please enter a number up to " << MAX_DIGITS << " digits: ";
readBig(num2);
addBig(num1, num2, sum);
printBig(num1);
cout << "\n+\n";
printBig(num2);
cout << "\n=\n";
printBig(sum);
cout << "\n";
cout << "test again?";
cin >> response;
cin.ignore(900, '\n');
done = toupper(response) != 'Y';
}
return 0;
}
```
**Explanation:**
This code snippet is written in C++ and is designed to handle 100-digit arithmetic operations. It includes the following main components:
1. **Function Prototypes:**
- `void readBig(int[]);` – To read a big integer.
- `void printBig(int[]);` – To print a big integer.
- `void addBig(int[], int[], int[]);` – To add two big integers.
2. **Constant Declaration:**
- `const int MAX_DIGITS = 100;` – Specifies the maximum number of digits for the big integers.
3. **Main Function:**
- Declares three arrays (`num1`, `num2`, `sum`) with a size of `MAX_DIGITS` to store two big integers and their sum.
- Uses a boolean flag `done` to control the loop.
- Inputs two numbers with at most 100 digits, adds them, and prints the result.
- Re](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f71a40a-4cff-4959-8946-a68dc332c184%2F8cd3eca5-bdba-4e5b-84b6-8291e71aac3a%2F6g6s5vr_processed.jpeg&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images









