Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask C/C++ Expert


Home >> C/C++

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

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M92802460
  • Price:- $55

Priced at Now at $55, Verified Solution

Have any Question?


Related Questions in C/C++

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As