I'm seeming to have some difficulties with a few things. I don't quite know how to get my program to add interest and charges to the balance, and I keep getting the message in Borland C++ Builder 6, "Unresolved external 'Interest(int)' referenced from C:\Documents and Settings......etc etc." and I'm also getting the same message for 'Charges(int)'. How do I fix that? Here my .cpp file and my .h file. Help would be greatly appreciated.

Contents of bank.cpp
--------------------------

#include <iostream>
#include <conio>
#include <iomanip>
#include <fstream>
#include <stdlib>
#include <dir>
#include "baccount.h"
using namespace std;

//These are all the functions used
void Deposit(int bal);
void Withdrawal(int bal);
void Balance(int bal);
void Interest(int bal);
void Charges(int bal);
void Menu();
void Exit();

//These are the variables used
int Dnum;
int bal;
char select;

int main(){

Menu();

return 0;
}
//The deposit function handles deposits coming into the program
void Deposit(){
clrscr();

cout << "\n\tEnter an amount: $";
cin >> Dnum;
Interest(bal);
Charges(bal);

ifstream balin("Bank.txt");
balin >> bal;
balin.close();

bal = bal + Dnum;

if(Dnum != 0){

ofstream Depo("Bank.txt");
Depo << bal;
Depo.close();

cout << "\n\tAmount deposited: $" << Dnum << endl;
cout << "\n\n\tYour balance is now: $" << bal << endl;

}
else
{
cout << "\n\tIncorrect amount, try again." << endl;

Menu();
}

cout << "\n\n\tPress any key to contine..." << endl;
Menu();

}
void Withdrawal(){
clrscr();
int Wnum;


cout << "\n\tEnter an amount: ";
cin >> Wnum;
Interest(bal);
Charges(bal);

if(Wnum != 0){
ifstream Without("Bank.txt");
Without >> bal;
Without.close();

bal = bal - Wnum;

if(bal < 0){
cout << "Your account can not be negative, please enter another amount." << endl;
Withdrawal();
}

ofstream Within("Bank.txt");
Within << bal;
Within.close();

}
cout << "\n\n\tAmount withdrawn: $" << Wnum;
cout << "\n\n\tYour balance is now: $" << bal;

cout << "\n\n\tPress any key to continue..." << endl;
Menu();
}

void Interest(){
clrscr();
int bal;
int annintrate = 0.6;
int monthlyint;
int monthlyintrate;


ifstream Balout("Bank.txt");
Balout >> bal;
Balout.close();

if(bal >= 25){
monthlyintrate = (annintrate/12);
monthlyint = bal * monthlyintrate;
bal = bal + monthlyint;
}
ofstream Balin("Bank.txt");
Balin << bal;
Balin.close();

cout << "\n\tYour current balance is: " << bal;
cout << "\n\nPress any key to continue..." << endl;
Menu();
}

void Charges(){
clrscr();
int withdraw;
int bal;

withdraw++;
bal = bal - (5 + 0.10);


if(withdraw >= 4)
{
withdraw++;
bal = bal - 1;
}
}

void Balance(){
clrscr();
int bal;

ifstream Balout("Bank.txt");
Balout >> bal;
Balout.close();

if(bal >= 25){
bal = bal;
}
ofstream Balin("Bank.txt");
Balin << bal;
Balin.close();

cout << "\n\tYour current balance is: " << bal;
cout << "\n\nPress any key to continue..." << endl;
Menu();
}

void Exit(){
cout << "\n\n\tEnd of program. Press any key to exit..." << endl;
}

void Menu(){
clrscr();

cout << "\t\t\tBank Account Project" << endl;
cout << "\t\t\t====================" << endl;

cout << "\n\n\t1) Make a Deposit" << endl;
cout << "\n\t2) Make a Withdrawal" << endl;
cout << "\n\t3) Check your Balance" << endl;
cout << "\n\t4) Quit" << endl;

cout << "\n\n\tEnter your selection: ";
cin >> select;

if(select == 1)
{
Deposit();
}
else if(select == 2)
{
Withdrawal();
}
else if(select == 3)
{
Balance();
}
else if(select == 4)
{
Exit();
}
getch();
}

Contents of baccount.h
---------------------------

#include <string>
using namespace std;

class Account {
protected:
  int bal;
  int dep;
  int with;
  int interest;
  int charges;
  int balance;
  int deposit;
  int withdraw;
  int calcInt;
  int monthlyProc;
  int monthlyint;
  int monthlyintrate;
  int annintrate;
public:
  Balance() { return balance; }
  NumDeposits() { return deposit; }
  NumWithdrawals() { return withdraw; }
  Interest()
  {
    if(bal >= 25)
    monthlyintrate = (annintrate/12);
    monthlyint = bal * monthlyintrate;
    bal = bal + monthlyint;

    return calcInt;
  }
  Charges()
  {
    if(withdraw >= 4)
    {
    withdraw++;
    bal = bal - 1;
    }
    else
    {
    withdraw++;
    bal = bal - (5 + 0.10);
    }

    return monthlyProc;
  }

  virtual void setBalance(int bal) { balance = bal; }
  virtual void setNumDep(int dep) { deposit = dep; }
  virtual void setNumWith(int with) { withdraw = with; }
  virtual void setInt(int interest) { calcInt = interest; }
  virtual void setCharges(int charges) { monthlyProc = charges; }

  virtual int getBalance() { return balance; }
  virtual int getNumDep() { return deposit; }
  virtual int getNumWith() { return withdraw; }
  virtual int getInt() { return calcInt; }
  virtual int getCharges() { return monthlyProc; }
};

class Savings:public Account
{
private:
  bool status;
  int bal;
  int monthlyintrate;
  int annintrate;
  int monthlyint;

public:
  Savings()
  {
    if(balance >= 25)
    status = true;
    else
    status = false;
  }
  Balance() { return balance; }
  NumDeposits() { return deposit; }
  NumWithdrawals() { return withdraw; }
  Interest()
  {
    if(bal >= 25)
    monthlyintrate = (annintrate/12);
    monthlyint = bal * monthlyintrate;
    bal = bal + monthlyint;

    return calcInt;
  }
  Charges()
  {
    if(withdraw >= 4)
    withdraw++;
    bal = bal - 1;

    return monthlyProc;
  }

  void setBalance(int bal) { balance = bal; }
  void setNumDep(int dep) { deposit = dep; }
  void setNumWith(int with) { withdraw = with; }
  void setInt(int interest) { calcInt = interest; }
  void setCharges(int charges) {monthlyProc = charges; }

  int getBalance() { return balance; }
  int getNumDep() { return deposit; }
  int getNumWith() { return withdraw; }
  int getInt() { return calcInt; }
  int getCharges() { return monthlyProc; }
};
class Checking : public Account
{
private:
  bool status;
  int bal;
  int monthlyintrate;
  int annintrate;
  int monthlyint;

public:
  Checking()
  {
    if(balance >= 25)
    status = true;
    else
    status = false;
  }
  Balance() { return balance; }
  NumDeposits() { return deposit; }
  NumWithdrawals() { return withdraw; }
  Interest()
  {
    if(bal >= 25)
    monthlyintrate = (annintrate/12);
    monthlyint = bal * monthlyintrate;
    bal = bal + monthlyint;

    return calcInt;
  }
  Charges()
  {
    if(withdraw >= 4)
    withdraw++;
    balance = balance - (5 + 0.10);
    monthlyProc = balance;

    return monthlyProc;
  }

  void setBalance(int b) { balance = b; }
  void setNumDep(int d) { deposit = d; }
  void setNumWith(int w) { withdraw = w; }
  void setInt(int i) { calcInt = i; }
  void setCharges(int c) {monthlyProc = c; }

  int getBalance() { return balance; }
  int getNumDep() { return deposit; }
  int getNumWith() { return withdraw; }
  int getInt() { return calcInt; }
  int getCharges() { return monthlyProc; }
};

baccount..h lines 20, 21 and 22. You need to specify the return type, such as int. Why are you using ints for balance, deposits and withdrawals -- only whole values acceptable with no cents ?

There are many many more errors due to not including the function return types and using int instead of float or double. I'm not going to tell you where the errors are because you can read this yourself from the error/warning messages you compiler spits out at you.

Thank you so much for the help.

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.