Demonstrate your programming abilities in c by adding a


Lab Assignment

Use the vector class to implement the addition a list of 26 huge integers. Also, you can implement the multiplication of the first two of these huge integers.

Purpose: Using the dynamic C++ templated vector class, write a program to add integers of any size. Your program will use methods in the standard C++ vector class to solve this problem. The input file will be read in as a string. Each string will be parsed and processed to store each digit into a vector. For example "1234567" will be processed into a vector object as [7, 6, 5, 4, 3, 2, 1, 0, 0, 0]. Notice this is backwards from its original number. However, this allows you to easily add digit by digit (left to right) into another vector object (also left to right) containing the accumulated sum. Note: this lab will replace your lowest lab score, and thus it will elevate your overall lab average score (40% of your final grade). It will not lower your overall lab score.

Problem:

1. Demonstrate your programming abilities in C++ by adding a given list of the first 26 very large integers (given in this specification sheet). You must use these data as input for your program.

2. The LargeTester.cpp will contain a "clean" main function and other functions you have designed to solve this problem.

3. After reading all the data in the file, close it and print your sum to the console and the output file.

4. For 10 points extra credit, your output skips 2 lines and re-displays the first two large integers, again. The next line should indicate the product of these two large integers. Send these 1st two large integers and product to both the console and to the output file.

5. There is a total of 26 large integers in the input file. You must use only this given input file.

6. To simplify the work in this last week, it is not necessary to format your large integers by right justifying them. Simply left justify all displayed outputs (in normal forward order).

7. When coding this lab project use copious comments to explain your solution. Document at least 50% of your code with comments. In other words if the class is 200 lines in length, document at least 100 of these lines with copious comments explaining your algorithm.

Input: Big26.in.txt (contains all 26 large integers to be read-in to your program). See the reverse side for the data.

Output: Echo Print all numbers read from the input file to the console and to the output file: Big26.out.txt. Additionally, the output file and console should indicate the sum (answer to adding all 26 numbers together). The extra credit function product will be similarly echo printed to both the console and the output file.

Checklist:

a. Print hard copies of your main file, LargeTester.cpp, Big26.in.txt, and Big26.out.txt.

The contents of the input file named: Big26.in.txt

27306206970702988134943455267
266653329641143800
692463309474
77398676015767719177524639281
3576180881983944117472340747925372
46727919169057102111
308757573234218091406187416940
510359921794679320320476
3641052680337839495115059
825372641582
2598510157997889186440938229
9089793549598160057
51163593833189098463897929410008623
7760861056897584938
6674786207173262962967975825945
3810612824
63423484013383433188
9479275622359614292930536791567664
1969366697062705198402050141905
99682648675
398958598215660852932804
74540765624605446300457
71520216939
718759950466335291172205
5540984481409
79416202465135548741890

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Demonstrate your programming abilities in c by adding a
Reference No:- TGS02759276

Now Priced at $55 (50% Discount)

Recommended (94%)

Rated (4.6/5)