I am a intro student to programming and learning C++ currently. I am working on a project that I need to build a main program that will pass parameters into two other classes to execute the code.
So I have three files:
main.cpp ( this has #include "bank.cpp", #include "bank.cpp"
bank.cpp ( this has nothing)
bank.hpp (this one has #include "bank.cpp" )
So now in the main.cpp I want to be able to call an instance of the bank and then add money to it. So I have something like:
bank.addMoney (which bank.addMoney is in bank.cpp)
Also the instance of the bank is in the hpp file which is like:
class bank{
private:
bool isBroken = false;
double savings = 0;
public:
}
When I compile the main program I get this error:
‘bank’ does not name a type
bank.defaultsettings(bool isBroken, double savings){
And then list that for all my .functions, Any guidance in what I did wrong would be appreciated.
MAIN FUNCTION:
#include <iostream>
using namespace std;
#include "bank.hpp"
#include "bank.cpp"
int main(){
cout << "Let's save some money!!!" << endl;
//bank.addMoney(isBroken, 10);
cout << "You've added $10to the bank" << endl;
}