Question: Using c++ Need help creating a program called LargeInteger that calculates fibonacci number from 0 to 1050. Functions you will need for this program. //LargeInteger.h
Using c++
Need help creating a program called LargeInteger that calculates fibonacci number from 0 to 1050.
Functions you will need for this program.
//LargeInteger.h header file.
class LargeInteger
{
private:
vector
/
public:
LargeInteger();
largeInteger(int);
LargeInteger(string);
LargeInteger operator++(int);
bool operator<=(largeInteger);
bool operator==(int);
bool operator==(LargeInteger);
LargeInteger operator-(LargeInteger);
largeInteger operator-(int);
LargeInteger operator+(LargeInteger);
bool operator<( const LargeInteger &) const; // Needed for the map
friend ostream & operator<<(ostream &, const LargeInteger &);
};
//LargeInteger.cpp
LargeInteger::LargeInteger() { value.push_back(0); } Given. doesn't need anything done to it.
LargeInteger::LargeInteger(int n) { // Needs works to be done here }
LargeInteger::LargeInteger(string n) { //Needs works to be done here }
LargeInteger ::LargeInteger operator++(int n) { //Needs works to be done here }
bool LargeInteger ::operator<(const LargeInteger & n) const { // Needs works to be done here }
bool LargeInteger ::operator<=(LargeInteger n) { // Needs works to be done here}
bool LargeInteger::operator==( LargeInteger n) { // Needs works to be done here}
LargeInteger LargeInteger::operator-(int n) { return *this - LargeInteger(n); } Given. Doesn't need anything done to it.
LargeInteger LargeInteger::operator-( LargeInteger n) { // Needs works to be done here }
LargeInteger LargeInteger::operator+( LargeInteger n) { // Needs works to be done here}
ostream & operator<<(ostream & out, const LargeInteger & n) { // Needs works to be done here }
//main.cpp
Main should look sometihng like this.
| map |
| LargeInteger Sheeps(LargeInteger n) |
| { |
| if (n==0 || n==1) |
| { |
| Map[n] = 1; |
| return Map[n]; |
| } |
| else |
| { |
| LargeInteger sum = Map[n-1] + Map[n-2]; |
| Map[n] = sum; |
| return Map[n]; |
| } |
| } |
int main(){
for (LargeInteger i = 0; i <= 1050; i++)
{
cout << (i<100 ? " " : " ") << "Sheep("< } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
