Hello all.

I am currently working on creating a program of a Checking Account and Savings Account. I am using my input file for deposits and withdraws. However, for my deposit and withdraw functions, I am unsure what to put in it. For those functions, am I suppose to read into the file and grab the information from the input file? This is my first time using a file with Classes. Any help is appreciated. Thanks


Input file looks like:

Deposit Savings 15.00
Withdraw Checking 7.00
etc.


I read into the file from main.cpp


Account.cpp

class SavingsAccount
{
	public:
		SavingsAccount();
		SavingsAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
		SavingsAccount::~SavingsAccount();
	private:
		double balance;
		const double WITHDRAWAL_FEE = 0.0;
}



class CheckingAccount
{
public:
      	CheckingAccount();
		CheckingAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
		CheckingAccount::~CheckingAccount();
       
       
private:
        
        double balance;
        double WITHDRAW_FEE = 0.5;
};


void SavingsAccount::SavingsAccount()
{
     balance = 100.00;
}

void SavingsAccount::setBalance(double amount)
{
    
    balance = amount; 
     
}


void SavingsAccount::withdraw(double amount)
{
     
     
}


void SavingsAccount::deposit(double amount)
{
     
     
     
}

double SavingsAccount::getBalance()
{
       
 return balance;      
       
}

SavingsAccount::~SavingsAccount()
{
                                 
                                 
                                 
}


void CheckingAccount::CheckingAccount()
{
     balance = 100.00;
}

void CheckingAccount::setBalance(double amount)
{
     
     balance = amount;
     
}



void CheckingAccount::withdraw(double amount)
{
     
     
}


void CheckingAccount::deposit(double amount)
{
     
     
     
}

double CheckingAccount::getBalance()
{
       
     
       
}

Account.h

#include <fstream>
using namespace std;
#include "---------.h"


int main()
{
    
    
    Savings SavingsAcct;
    SavingsAcct.getbalance();
    savingsAcct.setbalance(amount);
    savingsAcct.withdraw(amount);
    savingsAcct.deposit(amount); 
    
    Checking CheckingAcct;
    checkingAcct.getbalance();
    checkingAcct.setbalance(amount);
    checkingAcct.withdraw(amount);
    checkingAcct.deposit(amount);


cout<<endl;
system ("PAUSE");
return 0;
}

main.cpp

#include <fstream>
using namespace std;
#include "COSC214Lab3.h"


int main()
{
    
    
SavingsAccount savingsAcct();
CheckingAccount checkingAcct();

ifstream inData("input.txt");
ofstream outData("output.txt");

while(inData >> transactionType >> accountType >> amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == 'deposit')
		{
			savingsAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			savingsAcct.withdraw(amount);
		}
	}
	else if(accountType == 'checking')
	{
		if(transactionType == 'deposit')
		{
			checkingAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			checkingAcct.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
  
    
    
system ("PAUSE");
return 0;
}

Recommended Answers

All 45 Replies

I would imagine that the fact that the data is coming from a file is irrelevant to the withdraw and deposit functions. You're probably supposed to adjust balance:

void SavingsAccount::deposit(double amount)
{
    balance += amount;
}

Can't see what else it would be.

First off, I think you are missing a semicolon at the end of your SavingsAccount class (line 14, Account.cpp).

For your withdraw and deposit functions you could use:

///savings class


void SavingsAccount::withdraw(double amount)
{
	balance -= amount*(1+WITHDRAW_FEE);
}

void SavingsAccount::deposit(double amount)
{
	balance += amount;	
}


//checking class


void CheckingAccount::withdraw(double amount)
{
	balance -= amount*(1+WITHDRAW_FEE);	
}

void CheckingAccount::deposit(double amount)
{
	balance += amount;	
}

double CheckingAccount::getBalance()
{
	return balance;	
}

perfect time for class factoring! see how both classes have these methods:

void setBalance(double amount);

void withdraw(double amount);

void deposit(double amount);

double getBalance();

Make an "Account" class and inherit both the other classes from it ;D

Thank you for both of your responses.

It seems like I am only having declarations problems in my Account.cpp file. Are there any ideas on where to look to correct this problem?

Here is my updated program below.


Account.cpp

#include <fstream>
using namespace std;
#include "-----.h"


int main()
{
    
    
    Savings SavingsAcct;
    SavingsAcct.getbalance();
    savingsAcct.setbalance(amount);
    savingsAcct.withdraw(amount);
    savingsAcct.deposit(amount); 
    
    Checking CheckingAcct;
    checkingAcct.getbalance();
    checkingAcct.setbalance(amount);
    checkingAcct.withdraw(amount);
    checkingAcct.deposit(amount);


system ("PAUSE");
return 0;
}

Account.h

class SavingsAccount
{
	public:
		SavingsAccount();
		SavingsAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
	private:
		double balance;
		const double WITHDRAWAL_FEE = 0.0;
};



class CheckingAccount
{
public:
      	CheckingAccount();
		CheckingAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
       
       
private:
        
        double balance;
        double WITHDRAW_FEE = 0.5;
};


void SavingsAccount::SavingsAccount()
{
     balance = 100.00;
}

void SavingsAccount::setBalance(double amount)
{
    
    balance = amount; 
     
}


void SavingsAccount::withdraw(double amount)
{
   balance -= amount*(1+WITHDRAW_FEE);  
     
}


void SavingsAccount::deposit(double amount)
{
     balance += amount;	
     
}

double SavingsAccount::getBalance()
{
       
 return balance;      
       
}



void CheckingAccount::CheckingAccount()
{
     balance = 100.00;
}

void CheckingAccount::setBalance(double amount)
{
     
     balance = amount;
     
}



void CheckingAccount::withdraw(double amount)
{
     
    balance -= amount*(1+WITHDRAW_FEE); 
}


void CheckingAccount::deposit(double amount)
{
     
     balance += amount;	
     
}

double CheckingAccount::getBalance()
{
       
  return balance;   
       
}

main.cpp

#include <fstream>
using namespace std;
#include "----------.h"


int main()
{
    
    
SavingsAccount savingsAcct();
CheckingAccount checkingAcct();

ifstream inData("input.txt");
ofstream outData("output.txt");

while(inData >> transactionType >> accountType >> amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == 'deposit')
		{
			savingsAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			savingsAcct.withdraw(amount);
		}
	}
	else if(accountType == 'checking')
	{
		if(transactionType == 'deposit')
		{
			checkingAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			checkingAcct.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
  
    
    
system ("PAUSE");
return 0;
}

I updated my code and I am receiving a few errors that I need help correcting:

Errors:
- ISO C++ forbids initialization of member `WITHDRAWAL_FEE'
- ISO C++ forbids in-class initialization of non-const static member `WITHDRAW_FEE'
- multiple types in one declaration
- return type specification for constructor invalid

Here is my updated code:


Account.cpp

#include <fstream>
using namespace std;
#include "COSC214Lab3.h"


int main()
{
    
SavingsAccount savingsAcct();
CheckingAccount checkingAcct();

ifstream inData("input.txt");
ofstream outData("output.txt");

while(inData >> transactionType >> accountType >> amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == 'deposit')
		{
			savingsAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			savingsAcct.withdraw(amount);
		}
	}
	else if(accountType == 'checking')
	{
		if(transactionType == 'deposit')
		{
			checkingAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			checkingAcct.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
  
    
    
system ("PAUSE");
return 0;
}

.h file

class SavingsAccount
{
	public:
		SavingsAccount();
		SavingsAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
	private:
		double balance;
		const double WITHDRAWAL_FEE = 0.0;
};



class CheckingAccount
{
public:
      	CheckingAccount();
		CheckingAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
       
       
private:
        
        double balance;
        double WITHDRAW_FEE = 0.5;
};


void SavingsAccount::SavingsAccount()
{
     balance = 100.00;
}

void SavingsAccount::setBalance(double amount)
{
    
    balance = amount; 
     
}


void SavingsAccount::withdraw(double amount)
{
   balance -= amount*(1+WITHDRAW_FEE);  
     
}


void SavingsAccount::deposit(double amount)
{
     balance += amount;	
     
}

double SavingsAccount::getBalance()
{
       
 return balance;      
       
}



void CheckingAccount::CheckingAccount()
{
     balance = 100.00;
}

void CheckingAccount::setBalance(double amount)
{
     
     balance = amount;
     
}



void CheckingAccount::withdraw(double amount)
{
     
    balance -= amount*(1+WITHDRAW_FEE); 
}


void CheckingAccount::deposit(double amount)
{
     
     balance += amount;	
     
}

double CheckingAccount::getBalance()
{
       
  return balance;   
       
}

main.cpp

#include <fstream>
using namespace std;
#include "COSC214Lab3.h"


int main()
{
    
SavingsAccount savingsAcct();
CheckingAccount checkingAcct();

ifstream inData("input.txt");
ofstream outData("output.txt");

while(inData >> transactionType >> accountType >> amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == 'deposit')
		{
			savingsAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			savingsAcct.withdraw(amount);
		}
	}
	else if(accountType == 'checking')
	{
		if(transactionType == 'deposit')
		{
			checkingAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			checkingAcct.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
  
    
    
system ("PAUSE");
return 0;
}

Change your "WITHDRAW_FEE" declarations to

static const double WITHDRAW_FEE = 0.0;

Change the value to what you want but in order to declare a constant variable inside a class you need to make it static.

Also, you cannot assign a return type to a constructor.

You have:

void SavingsAccount::SavingsAccount()

and you want to change that to

//remove void
SavingsAccount::SavingsAccount()

I did the change, but unfortunately I am receiving the same error. Do you know what else it might be?

Are you sure?

In my quick test code I have a static const double working.

Post your class declarations.

Here is my updated program:


Account.cpp

#include <fstream>
using namespace std;
#include "COSC214Lab3.h"


int main()
{
    
    SavingsAccount savingsAcct;
    savingsAcct.getBalance();
    savingsAcct.setBalance(amount);
    savingsAcct.withdraw(amount);
    savingsAcct.deposit(amount); 
    
    CheckingAccount checkingAcct;
    checkingAcct.getBalance();
    checkingAcct.setBalance(amount);
    checkingAcct.withdraw(amount);
    checkingAcct.deposit(amount);


system ("PAUSE");
return 0;
}

.h file

class SavingsAccount
{
	public:
		SavingsAccount();
		SavingsAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
	private:
		double balance;
		static const double WITHDRAW_FEE = 0.0;

};



class CheckingAccount
{
public:
      	CheckingAccount();
		CheckingAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();
       
       
private:
        
        double balance;
        static const double WITHDRAW_FEE = 0.5;

};


SavingsAccount::SavingsAccount(double balance)
{
     balance = 100.00;
     
}

void SavingsAccount::setBalance(double amount)
{
    
    balance = amount; 
     
}


void SavingsAccount::withdraw(double amount)
{
   balance -= amount*(1+WITHDRAW_FEE);  
     
}


void SavingsAccount::deposit(double amount)
{
     balance += amount;	
     
}

double SavingsAccount::getBalance()
{
       
 return balance;      
       
}



CheckingAccount::CheckingAccount(double balance)
{
     balance = 100.00;
}

void CheckingAccount::setBalance(double amount)
{
     
     balance = amount;
     
}



void CheckingAccount::withdraw(double amount)
{
     
    balance -= amount*(1+WITHDRAW_FEE); 
}


void CheckingAccount::deposit(double amount)
{
     
     balance += amount;	
     
}

double CheckingAccount::getBalance()
{
       
  return balance;   
       
}

main.cpp

#include <fstream>
using namespace std;
#include "COSC214Lab3.h"


int main()
{
    
SavingsAccount savingsAcct();
CheckingAccount checkingAcct();

ifstream inData("input.txt");
ofstream outData("output.txt");

while(inData >> transactionType >> accountType >> amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == 'deposit')
		{
			savingsAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			savingsAcct.withdraw(amount);
		}
	}
	else if(accountType == 'checking')
	{
		if(transactionType == 'deposit')
		{
			checkingAcct.deposit(amount);
		}
		else if(transactionType == 'withdraw')
		{
			checkingAcct.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
  
    
    
system ("PAUSE");
return 0;
}

First off why do you have 2 main() functions declared?

I'm guessing one of your errors is from that.

Also you have 2 constructors in each class but you are only declaring 1.

SavingsAccount::SavingsAccount()
{
	balance = 100.0;
}

SavingsAccount::SavingsAccount( double balance )
{
	balance = balance;
}

is what you want I am assuming

Thanks. i fixed it and i also copied it to my checking account function.

My program is still giving that withdraw fee error. Did I correct it wrong?

It is also showing that amount is not declared in Account.cpp for savingsAcct.setBalance(amount)

Give me about 5 min I'm writing out the whole thing to see what is going on and I will post a working copy in a bit.

OK the format might be a bit different but it works.

This writes to "output.txt" and reads in from "input.txt"

"account.h"

#ifndef ACCOUNT_H
#define ACCOUNT_H

//SAVINGS ACCOUNT
class SavingsAccount
{
	double balance;
	static const double WITHDRAW_FEE = 0.0;
	
	public:
		
	SavingsAccount();
	SavingsAccount( double balance );
	
	void setBalance( double amount );
	
	void withdraw( double amount );
	void deposit( double amount );
	
	double getBalance();
};

//CHECKING ACCOUNT
class CheckingAccount
{
	double balance;
	static const double WITHDRAW_FEE = 0.5;
	
	public:
		
	CheckingAccount();
	CheckingAccount( double balance );
	
	void setBalance( double amount );
	
	void withdraw( double amount );
	void deposit( double amount );
	
	double getBalance();
};

//SAVINGS ACCOUNT FUNCTIONS
SavingsAccount::SavingsAccount()
{
	balance = 100.0;
}

SavingsAccount::SavingsAccount( double balance )
{
	balance = balance;
}

void SavingsAccount::setBalance( double amount )
{
	balance = amount;
}

void SavingsAccount::withdraw( double amount )
{
	balance -= amount*(1+WITHDRAW_FEE);
}

void SavingsAccount::deposit( double amount )
{
	balance += amount;
}

double SavingsAccount::getBalance()
{
	return balance;
}

//CHECKING ACCOUNT FUNCTIONS

CheckingAccount::CheckingAccount()
{
	balance = 100.0;
}

CheckingAccount::CheckingAccount( double balance )
{
	balance = balance;
}

void CheckingAccount::setBalance( double amount )
{
	balance = amount;
}

void CheckingAccount::withdraw( double amount )
{
	balance -= amount*(1+WITHDRAW_FEE);
}

void CheckingAccount::deposit( double amount )
{
	balance += amount;
}

double CheckingAccount::getBalance()
{
	return balance;
}

#endif

"main.cpp"

#include <fstream>
#include "account.h"

using namespace std;

int main()
{
	SavingsAccount savingsAccount;
	CheckingAccount checkingAccount;
	
	ifstream inData("input.txt");
	ofstream outData("output.txt");
	
	string transactionType, accountType;
	double amount;
	
	/* delete if you want
	format for "input.txt"
	
	accountType transactionType amount
	
	*/
	while(inData >> accountType >> transactionType >> amount )
	{
		if( accountType == "savings" )
		{
			
			if( transactionType == "deposit" )
			{
				savingsAccount.deposit(amount);
				
			}
			else if( transactionType == "withdraw" )
			{
				savingsAccount.withdraw(amount);
			}
		}
		else if( accountType == "checking" )
		{
			if( transactionType == "deposit" )
			{
				savingsAccount.deposit(amount);
			}
			else if( transactionType == "withdraw" )
			{
				savingsAccount.withdraw(amount);
			}
		}
	}
	outData << "Savings Total: " << savingsAccount.getBalance() << endl;
	outData << "Checking Total: " << checkingAccount.getBalance() << endl;
	
	system("PAUSE");
	return 0;
};

Just noticed that when I copy pasted I left some stuff in the main as savingsAccount when it should be checkingAccount.

while(inData >> accountType >> transactionType >> amount )
	{
		if( accountType == "savings" )
		{
			
			if( transactionType == "deposit" )
			{
				savingsAccount.deposit(amount);
				
			}
			else if( transactionType == "withdraw" )
			{
				savingsAccount.withdraw(amount);
			}
		}
		else if( accountType == "checking" )
		{
			if( transactionType == "deposit" )
			{
				savingsAcco2unt.deposit(amount);
			}
			else if( transactionType == "withdraw" )
			{
				savingsAccount.withdraw(amount);
			}
		}
	}

should change to

while(inData >> accountType >> transactionType >> amount )
	{
		if( accountType == "savings" )
		{
			
			if( transactionType == "deposit" )
			{
				savingsAccount.deposit(amount);
				
			}
			else if( transactionType == "withdraw" )
			{
				savingsAccount.withdraw(amount);
			}
		}
		else if( accountType == "checking" )
		{
			if( transactionType == "deposit" )
			{
				//change here
				checkingAccount.deposit(amount);
			}
			else if( transactionType == "withdraw" )
			{
				//change here
				checkingAccount.withdraw(amount);
			}
		}
	}

I am currently typing in changes manually.

I have one more question, is there a way i can output the number of transactions and withdraw fees to my output file?

I understand what you mean but would you want it for a multiple use counter or just how much you lost from the transaction fee on the one run of the program?

For these you could just declare a variable in the class structures and then whenever you withdraw it goes

balance -= amount*(1+WITHDRAW_FEE);
//name the variables whatever you want
totalLostToFee += amount*WITHDRAW_FEE;
transactionCounter++;

This code would go into your withdraw() functions and then you would make getTotalLostToFee() and getTransactionCounter() returning themselves. Use it the same way you output the balances to the text file.

I'm still getting that withdraw fee error! Did you change anything to the Account.cpp file?

Yeah I actually rewrote the whole thing out.

Just post your class structure and I'll take a look at what you have unless it is no different from your last code post.

"Account.h"
"Account.cpp"

I never even asked you about the WITHDRAW_FEE variable but is that supposed to be a percent or just a flat rate?

The way I set it up it is a percentage of what you withdraw so 0.50 would be 50% which is huge. If you want it as a flat $0.50 fee change it to

balance -= amount + WITHDRAW_FEE;

This is what I have:

COSC214Lab3.cpp

#include <fstream>
#include "COSC214Lab3.h"

using namespace std;



int main()
{
    
    SavingsAccount savingsAcct;
    savingsAcct.getBalance();
    savingsAcct.setBalance(amount);
    savingsAcct.withdraw(amount);
    savingsAcct.deposit(amount); 
    
    CheckingAccount checkingAcct;
    checkingAcct.getBalance();
    checkingAcct.setBalance(amount);
    checkingAcct.withdraw(amount);
    checkingAcct.deposit(amount);


system ("PAUSE");
return 0;
}

COSC214Lab3.h

#ifndef COSC214Lab3_H
#define COSC214Lab3_H

class SavingsAccount
{
      double balance;
      static const double WITHDRAW_FEE = 0.0;
      
	public:
		SavingsAccount();
		SavingsAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();

};



class CheckingAccount
{
      double balance;
      static const double WITHDRAW_FEE = 0.5;
      
public:
      	CheckingAccount();
		CheckingAccount(double balance);
		void setBalance(double amount);
		void withdraw(double amount);
		void deposit(double amount);
		double getBalance();

};


SavingsAccount::SavingsAccount()
{	
    
    balance = 100.0;

} 

SavingsAccount::SavingsAccount(double balance)
{	
    balance = balance;
    
}

void SavingsAccount::setBalance(double amount)
{
    
    balance = amount; 
     
}


void SavingsAccount::withdraw(double amount)
{
   balance -= amount*(1+WITHDRAW_FEE);  
   totalLostToFee += amount*WITHDRAW_FEE;
   transactionCounter++;
}


void SavingsAccount::deposit(double amount)
{
     balance += amount;	
     
}

double SavingsAccount::getBalance()
{
       
 return balance;      
       
}



CheckingAccount::CheckingAccount()
{	
    
    balance = 100.0;

} 

CheckingAccount::CheckingAccount(double balance)
{	
    balance = balance;
    
}

void CheckingAccount::setBalance(double amount)
{
     
     balance = amount;
     
}



void CheckingAccount::withdraw(double amount)
{
     
    balance -= amount*(1+WITHDRAW_FEE); 
    totalLostToFee += amount*WITHDRAW_FEE;
    tansactionCounter++;
}


void CheckingAccount::deposit(double amount)
{
     
     balance += amount;	
     
}

double CheckingAccount::getBalance()
{
       
  return balance;   
       
}
#include <fstream>
#include "COSC214Lab3.h"

using namespace std;



int main()
{
    
SavingsAccount savingsAcct;
CheckingAccount checkingAcct;

ifstream inData("input.txt");
ofstream outData("output.txt");

string transactionType, accountType;	
double amount;

while(inData >> accountType >> transactionType >>  amount)
{
	if(accountType == 'savings')
	{
		if(transactionType == "deposit")
		{
			savingsAccount.deposit(amount);
		}
		else if(transactionType == "withdraw")
		{
			savingsAccount.withdraw(amount);
		}
	}
	else if(accountType == "checking")
	{
		if(transactionType == "deposit")
		{
			checkingAccount.deposit(amount);
		}
		else if(transactionType == "withdraw")
		{
			checkingAccount.withdraw(amount);
		}
	}
}

outData << "Savings Total: " << savingsAcct.getBalance() << endl;
outData << "Checking Total: " << checkingAcct.getBalance() << endl;
    
    
system ("PAUSE");
return 0;
}

Yeah I want it as a flat $0.50 fee

Also you want the transactionCounter++; on deposits too.

That is if they are counted as transactions but I'm pretty sure they are.

And I see you still have single quotes around savings in the input.txt reader

I added it. It looks like the error is pointing at my #include "COSC214Lab3.h"

Should I declare totalLostToFee and transactionCounter in the Class where Withdraw_fee and balance are declared?

I'm not sure what compiler you are using but it should be telling you that you cannot have 2 main() functions declared in the same project.

Also by the looks of it, unless you just cut it off, you did not close the #ifndef "COSC214Lab3.h"
statement with
#endif at the bottom of the file

Yeah put it in there and then right below your getBalance() function add getTotalLostToFee() and getTransactionCounter().

Should I merge the 2 main.cpp into 1 main file?

Yeah, add it to the one with the ifsteam and ofstream in it.

Delete one of the sets of class declarations out of the main() or it will say it is already defined.

I am sending you my updated code...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.