(Exercise 11 in Chapter 9 explains how to add large integers using arrays. In th
ID: 3640390 • Letter: #
Question
(Exercise 11 in Chapter 9 explains how to add large integers using
arrays. In that exercise, the program could add only integers of, at
most, 20 digits.)
This chapter explains how to work with dynamic integers.
DESIGN A CLASS named largeIntegers such that an object of this class can store
an integer of any number of digits. ADD OPERATIONS TO ADD, SUBTRACT, MULTIPLY AND COMPARE INTEGERS STORED IN TWO OBJECTS. ALSO ADD CONSTRUCTORS TO PROPERLY INITIALIZE OBJECTS AND FUNCTIONS TO SET, RETRIEVE, AND PRINT THE VALUES OF OBJECTS. Also add constructors to properly initialize objects and functions to set, retrieve, and print the values of objects.
(THIS IS THE NEXT STEP - ONLY NEED THE MAIN CPP. I capitalized the section that this step includes.
(Step 2. If done by Sunday 11:59 PST I'll award Lifesaver, even if not complete; depends. Refer to http://www.cramster.com/answers-mar-12/computer-science/design-class-dynamic-ar-exercise-11-chapter-9-explains-add-large-integers_2264647.aspx?rec=0 for first step. I changed LargeInteger to largeIntegers.)
This is what I have so far for the main, can't figure out what's wrong with the number(input) part.
#include "largeIntegers.h"
#include <iostream>
#include <string>
using namespace std;
int main()
{
string input;
largeIntegers number1;
largeIntegers number2;
while(true)
{
cout << "Enter first number to add" << endl;
cin >> input;
largeIntegers number1(input);
cout << "Enter second number to add" << endl;
cin >> input;
largeIntegers number2(input);
cout << "answer: /n" << (number1 + number2) << endl;
}
return 0;
}
Explanation / Answer
I can't access your file in the link. It's locked by cramster. However, This link might help. If not, post the question again with the other code.
http://pastebin.com/kB1C7H1J
Good Luck
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.