I have seen some solutions to this problem in Bartleby's library that make no sense to me. I am learning C++, more specifically working with dynamic integers and have become confused with what has been provided previously by others. Using dynamic integers, can I get help with creating a class named 'largeIntegers' so that an object of this class can store an integer of any number of digits. If I could get help with setting up operations to add, subtract, multiply, and compare integers stored in two objects. Also, if someone could explain and help myself create constructors to properly initialize objects and functions to set, retrieve, and print the values of objects. There are three files I am working with: main.cpp, largeIntegers.h, and largeIntegers.cpp largeIntegers.cpp #include  using namespace std;   largeIntegers.h   //Specification file largeIntegers.h   #ifndef H_largeIntegers  #define H_largeIntegers    #include  using namespace std; #endif main #include  using namespace std; int main() {       return 0; }

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

I have seen some solutions to this problem in Bartleby's library that make no sense to me. I am learning C++, more specifically working with dynamic integers and have become confused with what has been provided previously by others.

Using dynamic integers, can I get help with creating a class named 'largeIntegers' so that an object of this class can store an integer of any number of digits. If I could get help with setting up operations to add, subtract, multiply, and compare integers stored in two objects. Also, if someone could explain and help myself create constructors to properly initialize objects and functions to set, retrieve, and print the values of objects.

There are three files I am working with:

main.cpp, largeIntegers.h, and largeIntegers.cpp

largeIntegers.cpp

#include <iostream>

using namespace std;
 
largeIntegers.h
 
//Specification file largeIntegers.h
 
#ifndef H_largeIntegers 
#define H_largeIntegers   

#include <iostream>
using namespace std;


#endif
main
#include <iostream>

using namespace std;

int main() {
 
    return 0;
}
C++
PROGRAMMING
BUY
DS. M
Chapte...
C++ Programming: Fr...
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage
Learning
Section...
Problem 4PE: Programming... :
Textbook Question
SHARE SOLUTION
Chapter 12, Problem 4PE
Programming Exercise 11 in Chapter 8 explains how to add large integers using arrays. However, 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 largelntegers 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.
Transcribed Image Text:C++ PROGRAMMING BUY DS. M Chapte... C++ Programming: Fr... 8th Edition ISBN: 9781337102087 Author: D. S. Malik Publisher: Cengage Learning Section... Problem 4PE: Programming... : Textbook Question SHARE SOLUTION Chapter 12, Problem 4PE Programming Exercise 11 in Chapter 8 explains how to add large integers using arrays. However, 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 largelntegers 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.
Expert Solution
Step 1: largeIntegers.h
1// largeIntegers.h
2
3#ifndef H_largeIntegers 
4#define H_largeIntegers   
5
6#include <iostream>
7#include <string>
8using namespace std;
9
10class largeIntegers {
11private:
12    string num;  // To simplify, we're storing the number as a string
13    bool isNegative;
14
15public:
16    largeIntegers(); 
17    largeIntegers(string s);
18    
19    void setNumber(string s);
20    string getNumber() const;
21    void print() const;
22
23    largeIntegers operator +(const largeIntegers& other);
24    largeIntegers operator -(const largeIntegers& other);
25    largeIntegers operator *(const largeIntegers& other);
26    bool operator ==(const largeIntegers& other);
27    bool operator !=(const largeIntegers& other);
28};
29
30#endif
31
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
ADT and Class
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
  • SEE MORE 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