Question: Trying to use header file and getting [Error] 'factorialIterative' was not declared in this scope I am learning how to use more than just one

Trying to use header file and getting [Error] 'factorialIterative' was not declared in this scope

I am learning how to use more than just one source code while programming and I keep getting this error even though I believe I have declared my function. Heres my code

BinomialFunctions.hpp

#ifndef _BINOMIALFUNCTIONS_H_ #define _BINOMIALFUNCTIONS_H_

#include #include using namespace std;

// global definitions typedef long int bigint; // give long int an alias name of bigint

// Function prototypes for our BinomialFunctions library go here class BinomialFunctions { private: bigint n; bigint i; public: bigint factorialIterative(bigint n); bigint factorialRecursive(bigint n); bigint countCombinationsDirectly(bigint n, bigint i); bigint countCombinationsRecursive(bigint n, bigint i); }; #endif // _BINOMIALFUNCTIONS_H_

BinomialFunctions.cpp

#include "BinomialFunctions.hpp"

using namespace std;

bigint BinomialFunctions::factorialIterative(bigint n) { bigint sum; sum = 0; if(n<=0) { return 1; } for(int index =0; index

Assignment04.cpp

#include #include #include // measure elapsed time of functions using high resolution clock #include "BinomialFunctions.hpp"

using namespace std;

int main(int argc, char** argv) { // test iterative version of factorial cout << "Testing iterative version factorialIterative() " << endl; cout << "-------------------------------------------------------------" << endl; bigint res; res = factorialIterative(0); //[Error] 'factorialIterative' was not declared in this scope cout << "Test base case: factorialIterative(0) = " << res << endl; assert(res == 1); return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!