Question
Exercise 4.1 (bigint)Write a program that applies the arithmetic operations +, -, *, namely, addition, subtraction, and multiplication, to arbitrary-large pairs of integers in exact
Exercise 4.1 (bigint)Write a program that applies the arithmetic operations +, -, *, namely, addition, subtraction, and multiplication, to arbitrary-large pairs of integers in exact precision. The program prompts the user to enter two (arbitrary-large) integers and a digit, either 0, 1, or 2, that indicates whether to apply addition, subtraction, or multiplication, respectively. The arbitrary-large integers that are operands of the arithmetic operations can be negative. Please use the following phrases (without the double quotes): Please enter the first integer: Please enter the second integer: Please enter the command (0=+, 1=-, 2=*): Examples: > b i g i n t Pl eas e ent e r the f i r s t i n t e g e r : 123456789012345678901234567890 Pl eas e ent e r the second i n t e g e r : 234567890123456789012345678901 Pl eas e ent e r the command (0=+, 1=, 2=): 2 28958998520042688603718947735485444664031397677651425088890 > b i g i n t Pl eas e ent e r the f i r s t i n t e g e r : 11 Pl eas e ent e r the second i n t e g e r : 17 Pl eas e ent e r the command (0=+, 1=, 2=): 1 28 Use the following enumeration called Command to represent the three commands: 1 enum Command { ADD = 0 , SUB, MUL } ; Place the above in the file Command.hpp and use it. Implement a class called Bi g int , objects of which represent arbitrary-large integers. In the private section of the class declare the following two data members: 1 bool m_is_negative ; 2 s td : : l i s t
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started