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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.
Transcribed Image Text:**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.
```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
Transcribed Image Text:```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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Introduction to Coding
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education