One possible solution to implement the addition operation is to store the large numbers as strings of numerals, store the numbers corresponding to these numerals in two stacks, and then perform addition by popping numbers from the stacks. The pseudocode for this algorithm is as follows:
1. Read the first number as a string of characters.
2. Store the digit corresponding to each character on a stack (for example, each stack element could hold an int, which would correspond to one character in the input string). The order of pushing the digits on the stack should be such that the least significant digit appears at the top of the stack.
3. Repeat steps 1 and 2 for the second number.
4. Create a stack for the result.
5. set carry = 0.
5. While at least one of the stack is not empty
Pop a digit from each non-empty stack and add them.
sum = num1 + num2 + carry
Push the unit part of sum on the result stack.
Save carry.
6. When one of the stacks is empty, push the digits from the other stack on to the result stack, taking care of the carry.
7. If both stacks get empty at the same time, push the carry on the result stack if it is not zero.
7. Pop numbers from the result stack and display them ( as character string).
## Deliverables
The project will be limited to developing software for carrying out addition and multiplication of two very large numbers. The basic process will be similar to the way you have been doing multiplication in elementary school ( multiplying by one digit at a time). You can draw upon the idea presented above for addition of two numbers to carry out multiplication. Pop one digit from second stack, and multiply all the digits of first stack with this, and save the result in a temporary stack. Add this to the result stack.
**_User Input Specification_**
1. The user will enter a valid input file name.
2. The input file will contain the two character strings representing the two positive numbers.
3. It is specified that the result of the multiplication will not be longer than 100 digits.
4. On prompting the user will enter the output file name.
**_Data Processing_**
Develop functions for
- reading data from file, and writing onto a file . (Convert each character read from the file into the corresponding digit, when building up the stacks. )
- ARRAY BASED push and pop routines which can operate on any one of the
stacks at a time.
- addition, multiplication and display of results.
**_Output Specification_**
1. Save the results of addition and multiplication on two lines in that order, on the output file specified by the user.
2. Display the results on the screen.
**_Sample Input File _** *[login to view URL]*.
3523011938638144
619232
**_Sample Output Samples_**
Here is a sample output for the file *[login to view URL]*.
Enter the name of the file containing the grades
**[login to view URL]**
Enter the name of the output file to hold the result:
**[login to view URL]**
Result of addition:
3523011939257376
Result of multiplication:
2181561728786775185408
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
Source code in just plain old C