I need help with my project for my c++ class. I need to create a class called "bigint".
Requirements:
-You must use the class construct to implement your ADT.
-The ADT bigint need only work for positive numbers.
-Use a global constant value for the maximum size of the bigint that is, a constant sized array.
Implementation:
-The size of the bigint must be specified by a global constant
-A method (constructor) to initialize a bigint to zero.
-A method (constructor) to initialize a bigint to an int value you provide [0, maxint]. Example: bigint(128).
-A method (constructor) to initialize a bigint to a char[] you provide. You can assume what is provided is a valid bigint. Example: bigint("299793").
-A method to write a bigint that prints at most 60 digits per line.
-A method to compare if two bigints are equal. It should return a bool - true if equal and false otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#ifndef BIGINT_H
#define BIGINT_H
#include <iostream>
const in BIGINT_SIZE = 128;
class bigint{
public:
bigint();
bigint(int);
bigint(const char[]);
bigint output(std::ostream &out);
private:
int number [BIGINT_SIZE];
};
#endif
|
So that is my code. My current issue is that i need a default constructor to initialize bigint to 0.
The test file is:
1 2 3 4 5 6 7 8 9
|
#include bigint.h
#include <cassert>
#include <iostream>
int main()
{
bigint bi;
assert(b == 0);
std::cout << "0 == ";
}
|
I cannot change the test file. Right now I am getting an error of "no match for 'operator==' in 'bi == 0'". I do not understand why. i though i initialized the bigint to 0 with "bigint();". I'm confused and desperately need help here.