Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ implementation for defining signed integers with a maximum size of 100. Use this interface, BigNum.h. Check for underflow and overflow. #ifndef _BIG_NUM_H

Write a C++ implementation for defining signed integers with a maximum size of 100. Use this interface, BigNum.h. Check for underflow and overflow.

#ifndef _BIG_NUM_H #define _BIG_NUM_H namespace PROGM {

class BigNum { public: static const int MAX_VALUES = 100; enum class Signed {POSITIVE, NEGATIVE,ZERO};

BigNum (); //initialize to 0 BigNum(long long a); //exits if too large BigNum(std::string b); //exits if too large int getLen() const;

int cmp(BigNum& op2) const; //returns -1 if less, 0 if equal, or 1 if greater

BigNum abs() const; //does absolute value BigNum sum(BigNum& op2) const; BigNum difference(BigNum& op2) const; BigNum multiplication(BigNum& op2) const; BigNum division(BigNum& op2) const; BigNum remainder(BigNum& op2) const;

friend std::ostream& operator <<(std::ostream& os, const BigNum& a);

private: int values[MAX_VALUES]; Signed signed; int length; // length of number not including sign

}; } #endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

-5/6 + (-2/9)

Answered: 1 week ago