Question
please please help me and use c++ here is the output i need the question is somehow make code i have given to make the
please please help me and use c++
here is the output i need
the question is somehow make code i have given to make the output pictures i have given please help
i wasn't given question just given the output only sorry i wasn't much help
this should help you what each test should do
Test 0 3: Constructors
Test 4-8: Binary Operators
Test 9-10 : Unary Operators
Test 11-12: Comparison and operator>>()
Test 13-14: Assignment operator, index operator, conversion operator, destructor
output pictures
here is my code so far.
hugeint.cpp
#include //isdigit()
#include //strlen
#include "HugeInt.h"
using std::endl;
using std::cout;
HugeInt::HugeInt(long value)
{
cout
number = new short[30];
for (int i = 0; i
number[i] = 0;
//Complete the code here to set number[i]
computeSize();
}
//Set the size of the number of an HugeInt object
void HugeInt::computeSize()
{
}
HugeInt::HugeInt(const char * string)
{
cout
number = new short[30];
for (int i = 0; i
number[i] = 0;
int length = strnlen(string, 30);
//Complete the code here to set number[i]
computeSize();
}
HugeInt::HugeInt(const HugeInt & copy)
{
cout
}
HugeInt::~HugeInt()
{
cout
}
HugeInt & HugeInt::operator = (const HugeInt & right)
{
cout
}
HugeInt HugeInt::operator + (const HugeInt & right)
{
cout
}
HugeInt HugeInt::operator - (const HugeInt & right)
{
cout
}
HugeInt HugeInt::operator * (const HugeInt & right)
{
cout
}
HugeInt HugeInt::operator / (const HugeInt & right)
{
cout
}
HugeInt HugeInt::operator % (const HugeInt & right)
{
cout
}
HugeInt & HugeInt::operator++()
{
cout
}
HugeInt HugeInt::operator++(int)
{
cout
}
short & HugeInt::operator[](int pos)
{
cout
}
HugeInt::operator long double()
{
cout
}
bool HugeInt::operator
cout
}
ostream & operator
{
cout
}
istream & operator >> (istream & in , HugeInt & n)
{
cout >(istream&, HugeInt& )"
//Converting a string to char* can be done with c_str() member function of string type
}
hugeint.h
#ifndef HUGEINT_H
#define HUGEINT_H
#include
using std::ostream;
using std::istream;
using std::string;
class HugeInt {
private:
short * number;
int size;
void computeSize();
public:
HugeInt(long = 0);
HugeInt(const char * );
HugeInt(const HugeInt & );
~HugeInt();
HugeInt & operator = (const HugeInt & );
HugeInt operator + (const HugeInt & );
HugeInt operator - (const HugeInt & );
HugeInt operator * (const HugeInt & );
HugeInt operator / (const HugeInt & );
HugeInt operator % (const HugeInt & );
HugeInt & operator++();
HugeInt operator++(int);
bool operator
short & operator[](int);
operator long double();
friend ostream & operator
friend istream & operator >> (istream & , HugeInt & );
};
#endif
main.cpp
#include
#include "HugeInt.h"
using namespace std;
void displayTestCase(int); int main() {
int count = 0; displayTestCase(count++); HugeInt n1(765321); cout
displayTestCase(count++); HugeInt n2("9999999999999999999999999999"); cout
displayTestCase(count++); HugeInt n3("0000000000000000000000000001"); cout
displayTestCase(count++); HugeInt n4; cout
displayTestCase(count++); HugeInt n5 = n2 + n3; cout
displayTestCase(count++); HugeInt n6 = n2 - n1; cout
displayTestCase(count++); n5 = n1 * n3; cout
displayTestCase(count++); n6 = n2 / n1; cout
displayTestCase(count++); n6 = n2 % n1; cout
displayTestCase(count++); n6++; cout
displayTestCase(count++); n5 = n6++; cout
displayTestCase(count++); cout
displayTestCase(count++); HugeInt n7; cin >> n7; cout > n7 : "
displayTestCase(count++); n7 = n4; cout
displayTestCase(count++); cout
displayTestCase(count++); long double value = n5; cout
void displayTestCase(int count) { cout BP@CS:~/CMSC2613/F2020/P6$ p6 Test @ HugeInt(long) called ni using long : operator>(istream&, Huge Int& ) Enter a string for a number: 12345678901234567890123 Huge Int(const char*) called operator=(const Huge Int&) called HugeInt(const Huge Int&) called HugeInt() called HugeInt() called n7 after cin >> n7 : operator>(istream&, Huge Int& ) Enter a string for a number: 12345678901234567890123 Huge Int(const char*) called operator=(const Huge Int&) called HugeInt(const Huge Int&) called HugeInt() called HugeInt() called n7 after cin >> n7 : operator
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