Hi,
I am having problems with my problem 4.This is what I have as my code. I have 7 compiler errors in it. I don't know how to put the ATM into my program. My project is due wed night
and I am cramming to finish this. But I need a little help
Thanks
Rob

// Author: Robert Dovell
// Source file: Project 4.cpp
//Description: Check Register
//Compiler: Microsoft Visual Studio.NET

#include <iostream.h>
#include "apstring.h" 
#include "account.h" 
#include "bank.h" 
#include <fstream.h> 
#include <iomanip.h> 
#include <assert.h> 
#include "stdafx.h"
using namespace std;

void dep (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile, apstring &payee);
void with (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring &checknumber, ofstream &checkfile, apstring &payee);
void trans (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile);
void print (bank &user, apstring savcheck);
void inquire (bank &user);
void savings_file (bank &user, int &savnumber, ofstream &savfile, apstring operation, double amount);
void checking_file (bank &user, apstring checknumber, ofstream &checkfile, apstring payee, double amount);


int main ()
{
bool done = 0, back = 0;
bank user;
int choice = 0, savnumber = 0, choice2 = 0;
double amount = 0;
apstring savcheck, payee, checknumber;
ofstream savfile, checkfile;
assert (!savfile.fail());

savfile.open ("savings.txt");
checkfile.open ("checking.txt");
assert (!checkfile.fail());
savfile << "+-------------------+---------------------------+-------------+-------------+\n";
savfile << "|" << setw(16) << "Transaction #" << setw (4) << "|" << setw(22) << "Transaction Type" << setw (6) << "|" << setw (10) << "Amount" << setw (4) << "|" << setw(10) << "Balance" <<setw (5) << "|\n";
savfile << "+-------------------+---------------------------+-------------+-------------+\n";
checkfile << "+-----------+-----------------------------------+-------------+-------------+\n";
checkfile << "|" << setw (9) << "Check #" << setw (3) << "|" << setw (20) << "Payee" << setw (16) << "|" << setw (10) << "Amount" << setw (4) << "|" << setw(10) << "Balance" << setw (5) << "|\n";
checkfile << "+-----------+-----------------------------------+-------------+-------------+\n";
cout << setiosflags (ios::fixed|ios::showpoint);
cout << setprecision (2);
cout << "Welcome to the Ist Mariner Bank!\n";
cout << "\nPlease enter your starting balance (Checking): $";
cin >> amount;
user.deposit (amount, "checking");
checking_file (user, checknumber, checkfile, "Starting Balance", amount);
cout << "Please enter your starting balance (Savings): $";
cin >> amount;
user.deposit (amount, "savings");
savings_file (user, savnumber, savfile, "Starting Balance", amount);
savnumber++;
amount = user.goto_interest ();
cout << "You earned $" << amount << " interest this month.\n";
user.deposit (amount, "savings");
cout << "Your current savings balance is: $" << user.print_savings ();
savings_file (user, savnumber, savfile, "Interest", amount);
savnumber++;


while (! done)
{
cout << "\n\n\t1. Checking\n";
cout << "\t2. Savings\n";
cout << "\t0. Quit\n";
cout << "\nPlease enter which account you want to use: ";
cin >> choice;

switch (choice)
{
case 1 : savcheck = "Checking";
back = 0;
break;
case 2 : savcheck = "Savings";
back = 0;
break;
case 0 : done = 1;
back = 1;
break;
default : cout << "You entered an invalid entry, please reconsider it.\n";
break;
}

while (! back)
{
cout << "\n\t1. Deposit\n";
cout << "\t2. Withdrawal\n";
cout << "\t3. Transfer\t\t\t\tYou are in your\n";
cout << "\t4. Print Balances\t\t\t" << savcheck << " acount\n";
cout << "\t0. Return to previous menu\n";
cout << "\nSelect amount transaction: ";
cin >> choice2;
cout << endl;

switch (choice2)
{
case 1 : dep (user, amount, savcheck, savnumber, savfile, checknumber, checkfile, payee);
if (savcheck == "Savings" || savcheck == "savings") savnumber++;
print (user, savcheck);
break;
case 2 : with (user, amount, savcheck, savnumber, savfile, checknumber, checkfile, payee);
if (savcheck == "Savings" || savcheck == "savings") savnumber++;
print (user, savcheck);
break;
case 3 : trans (user, amount, savcheck, savnumber, savfile, checknumber, checkfile);
savnumber++;
print (user, savcheck);
break;
case 4 : inquire (user);
break;
case 0 : back = 1;
break;
default : cout << "You entered an invalid entry, please reconsider it.\n";
break;
}
}
}
cout << "\nThank you for using the Williston Bank!\n";
cout << "You can access the data to your accounts using amount wordprocessor.\n";
cout << "The file names are: 'savings.txt' and 'checking.txt'\n\n";

savfile << "+-------------------+---------------------------+-------------+-------------+";
checkfile << "+-----------+-----------------------------------+-------------+-------------+";

return 0;
}


void dep (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile, apstring &payee)
//This function will ask the user for the amount that should be deposited and deposits it to the right account
{
cout << "Please enter the amount of money you want to deposit: $";
cin >> amount;
if (savcheck == "Checking" || savcheck == "checking")
{
if (amount >= 0)
{
user.deposit (amount, savcheck);
checking_file (user, checknumber, checkfile, "Deposit", amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
}
else
{
if (amount >= 0)
{
user.deposit (amount, savcheck);
savings_file (user, savnumber, savfile, "Deposit", amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
}
}

void with (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring &checknumber, ofstream &checkfile, apstring &payee)
//This function will ask the user for the amount that should be withdrawn and withdraws it from the right account
{
cout << "Please enter the amount of money you want to withdraw: $";
cin >> amount;
getline (cin, payee);
if (savcheck == "Checking" || savcheck == "checking")
{
if (amount <= user.print_checking())
{
user.withdraw (amount, savcheck);
cout << "Please enter the checknumber: ";
getline (cin, checknumber);
cout << "Please enter whose order the check should be paid to: ";
getline (cin, payee);
checking_file (user, checknumber, checkfile, payee, amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
}
else
{
if (amount <= user.print_savings())
{
user.withdraw (amount, savcheck);
savings_file (user, savnumber, savfile, "Withdrawal", amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
}
}

void trans (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile)
//This function will ask the user from which account he/she wants to transfer and the amount that should be transfered
{
cout << "Please enter the amount of money you want to transfer: $";
cin >> amount;
if (savcheck == "Checking" || savcheck == "checking")
{
if (amount <= user.print_checking())
{
user.transfer (amount, savcheck);
savings_file (user, savnumber, savfile, "Transf from Checking", amount);
checking_file (user, " ", checkfile, "Transf to Savings", amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
}
else
{ 
if (amount <= user.print_savings())
{
user.transfer (amount, savcheck);
savings_file (user, savnumber, savfile, "Transf to Checking", amount);
checking_file (user, " ", checkfile, "Transf from Savings", amount);
}
else cout << "You entered an invalid entry, please reconsider it.\n";
} 
}

void print (bank &user, apstring savcheck)
//This function prints the balance of either the checking or the savings account
{
if (savcheck == "Checking" || savcheck == "checking")
cout << "Current Checking balance: $" << user.print_checking () << endl;
else 
cout << "Current Savings balance: $" << user.print_savings () << endl;
}

void inquire (bank &user)
//This function pritns out the balances for both accounts
{
cout << "Current Checking balance: $" << user.print_checking () << endl;
cout << "Current Savings balance: $" << user.print_savings () << endl;
}

void savings_file (bank &user, int &savnumber, ofstream &savfile, apstring operation, double amount)
//This function will output all the savings account transactions to amount text file "savings.txt"
{
savfile << "|" << setw (10) << savnumber << setw (10) << "|" << setw (22) << operation << setw (6) << "|" << setw (10) << amount << setw (4) << "|" << setw (10) << user.print_savings () << setw (5) << "|\n";
}

void checking_file (bank &user, apstring checknumber, ofstream &checkfile, apstring payee, double amount)
//This function will output all the checking account transactions to amount text file "checking.txt"
{
checkfile << "|" << setw (6) << checknumber << setw (6) << "|" << setw (26) << payee << setw (10) << "|" << setw (8) << amount << setw (6) << "|" << setw (8) << user.print_checking () << setw (7) << "|\n";
}

Recommended Answers

All 7 Replies

I don't know how to put the ATM into my program

neither do we if you don't post the rest of the program. Zip up all the source file and header files (bank.h and account.h) and attach them to your post.

also tell us what compiler and operating system you are using, and post the compiler errors.

[edit]Just noticed -- you must be using MSVC++ compiler because you include stdafx.h. That header must be the very first one listed. And remove the .h extension from the other standard headers because they are obsolete. Your program should look like this[/edit]

#include "stdafx.h"
#include <iostream>
#include <fstream> 
#include <iomanip> 
#include <cassert> 
#include "apstring.h" 
#include "account.h" 
#include "bank.h" 
using namespace std;

Hello,
I am using Microsoft Visual Studio.Net 2003 with Microsoft Windows XP.
These are my errors

 ------ Build started: Project: Project 4, Configuration: Debug Win32 ------

Compiling...
Project 4.cpp
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(69) : error C2143: syntax error : missing ';' before '&'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(69) : error C2501: 'ostream' : missing storage-class or type specifiers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(69) : error C2065: 'os' : undeclared identifier
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(69) : error C2059: syntax error : 'const'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2501: 'istream' : missing storage-class or type specifiers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2065: 'is' : undeclared identifier
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2065: 'str' : undeclared identifier
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2275: 'apstring' : illegal use of this type as an expression
        c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(23) : see declaration of 'apstring'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2501: 'operator`>>'' : missing storage-class or type specifiers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : error C2078: too many initializers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2143: syntax error : missing ';' before '&'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2501: 'istream' : missing storage-class or type specifiers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2086: 'int istream' : redefinition
        c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : see declaration of 'istream'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C3861: 'is': identifier not found, even with argument-dependent lookup
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2275: 'apstring' : illegal use of this type as an expression
        c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(23) : see declaration of 'apstring'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C3861: 'str': identifier not found, even with argument-dependent lookup
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2501: 'getline' : missing storage-class or type specifiers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(71) : error C2078: too many initializers
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\bank.h(20) : warning C4183: 'deposit': missing return type; assumed to be a member function returning 'int'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\bank.h(21) : warning C4183: 'withdraw': missing return type; assumed to be a member function returning 'int'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\bank.h(22) : warning C4183: 'transfer': missing return type; assumed to be a member function returning 'int'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(49) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(53) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(71) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(93) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'apstring' (or there is no acceptable conversion)
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(96) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(137) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(162) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(163) : error C2064: term does not evaluate to a function taking 2 arguments
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(170) : error C2064: term does not evaluate to a function taking 2 arguments
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(172) : error C2064: term does not evaluate to a function taking 2 arguments
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(192) : error C2872: '>>' : ambiguous symbol
        could be 'c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(70) : int &>>'
        or       '>>'
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(234) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'apstring' (or there is no acceptable conversion)
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Project 4.cpp(240) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'apstring' (or there is no acceptable conversion)

Build log was saved at "file://c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Debug\BuildLog.htm"
Project 4 - 31 error(s), 3 warning(s)


---------------------- Done ----------------------

    Build: 0 succeeded, 1 failed, 0 skipped

Project 4

// Author:            Robert Dovell
// Source file:       Project 4.cpp
//Description:        Check Register
//Compiler:           Microsoft Visual Studio.NET

#include "stdafx.h"
#include <iostream>
#include <fstream> 
#include <iomanip> 
#include <cassert> 
#include "apstring.h" 
#include "account.h" 
#include "bank.h" 
using namespace std;


void dep (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile, apstring &payee);
void with (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring &checknumber, ofstream &checkfile, apstring &payee);
void trans (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile);
void print (bank &user, apstring savcheck);
void inquire (bank &user);
void savings_file (bank &user, int &savnumber, ofstream &savfile, apstring operation, double amount);
void checking_file (bank &user, apstring checknumber, ofstream &checkfile, apstring payee, double amount);


int main ()
{
    bool done = 0, back = 0;
    bank user;
    int choice = 0, savnumber = 0, choice2 = 0;
    double amount = 0;
    apstring savcheck, payee, checknumber;
    ofstream savfile, checkfile;
    assert (!savfile.fail());

    savfile.open ("savings.txt");
    checkfile.open ("checking.txt");
    assert (!checkfile.fail());
    savfile << "+-------------------+---------------------------+-------------+-------------+\n";
    savfile << "|" << setw(16) << "Transaction #" << setw (4) <<  "|" << setw(22) << "Transaction Type" << setw (6) << "|" << setw (10) << "Amount" << setw (4) << "|" << setw(10) << "Balance" <<setw (5) << "|\n";
    savfile << "+-------------------+---------------------------+-------------+-------------+\n";
    checkfile << "+-----------+-----------------------------------+-------------+-------------+\n";
    checkfile << "|" << setw (9) << "Check #" << setw (3) << "|" << setw (20) << "Payee" << setw (16) << "|" << setw (10) << "Amount" << setw (4) << "|" << setw(10) << "Balance" << setw (5) << "|\n";
    checkfile << "+-----------+-----------------------------------+-------------+-------------+\n";
    cout << setiosflags (ios::fixed|ios::showpoint);
    cout << setprecision (2);
    cout << "Welcome to the Williston Bank!\n";
    cout << "\nPlease enter your starting balance (Checking): $";
    cin  >> amount;
    user.deposit (amount, "checking");
    checking_file (user, checknumber, checkfile, "Starting Balance", amount);
    cout << "Please enter your starting balance  (Savings): $";
    cin  >> amount;
    user.deposit (amount, "savings");
    savings_file (user, savnumber, savfile, "Starting Balance", amount);
    savnumber++;
    amount = user.goto_interest ();
    cout << "You earned $" << amount << " interest this month.\n";
    user.deposit (amount, "savings");
    cout << "Your current savings balance is: $" << user.print_savings ();
    savings_file (user, savnumber, savfile, "Interest", amount);
    savnumber++;


    while (! done)
    {
        cout << "\n\n\t1. Checking\n";
        cout << "\t2. Savings\n";
        cout << "\t0. Quit\n";
        cout << "\nPlease enter which account you want to use: ";
        cin  >> choice;

        switch (choice)
        {
            case 1 : savcheck = "Checking";
                     back = 0;
                break;
            case 2 : savcheck = "Savings";
                     back = 0;
                break;
            case 0 : done = 1;
                     back = 1;
                break;
            default : cout << "You entered an invalid entry, please reconsider it.\n";
                break;
        }

        while (! back)
        {
            cout << "\n\t1. Deposit\n";
            cout << "\t2. Withdrawal\n";
            cout << "\t3. Transfer\t\t\t\tYou are in your\n";
            cout << "\t4. Print Balances\t\t\t" << savcheck << " acount\n";
            cout << "\t0. Return to previous menu\n";
            cout << "\nSelect amount transaction: ";
            cin  >> choice2;
            cout << endl;

            switch (choice2)
            {
                case 1 : dep   (user, amount, savcheck, savnumber, savfile, checknumber, checkfile, payee);
                         if (savcheck == "Savings" || savcheck == "savings") savnumber++;
                         print (user, savcheck);
                    break;
                case 2 : with  (user, amount, savcheck, savnumber, savfile, checknumber, checkfile, payee);
                         if (savcheck == "Savings" || savcheck == "savings") savnumber++;
                         print (user, savcheck);
                    break;
                case 3 : trans (user, amount, savcheck, savnumber, savfile, checknumber, checkfile);
                         savnumber++;
                         print (user, savcheck);
                    break;
                case 4 : inquire (user);
                    break;
                case 0 : back = 1;
                    break;
                default : cout << "You entered an invalid entry, please reconsider it.\n";
                    break;
            }
        }
    }
    cout << "\nThank you for using the Williston Bank!\n";
    cout << "You can access the data to your accounts using amount wordprocessor.\n";
    cout << "The file names are: 'savings.txt' and 'checking.txt'\n\n";

    savfile <<   "+-------------------+---------------------------+-------------+-------------+";
    checkfile << "+-----------+-----------------------------------+-------------+-------------+";

    return 0;
}


void dep (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile, apstring &payee)
//This function will ask the user for the amount that should be deposited and deposits it to the right account
{
    cout << "Please enter the amount of money you want to deposit: $";
    cin  >> amount;
    if (savcheck == "Checking" || savcheck == "checking")
    {
        if (amount >= 0)
        {
            user.deposit (amount, savcheck);
            checking_file (user, checknumber, checkfile, "Deposit", amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }
    else
    {
        if (amount >= 0)
        {
            user.deposit (amount, savcheck);
            savings_file (user, savnumber, savfile, "Deposit", amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }
}

void with (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring &checknumber, ofstream &checkfile, apstring &payee)
//This function will ask the user for the amount that should be withdrawn and withdraws it from the right account
{
    cout << "Please enter the amount of money you want to withdraw: $";
    cin  >> amount;
    getline (cin, payee);
    if (savcheck == "Checking" || savcheck == "checking")
    {
        if (amount <= user.print_checking())
        {
            user.withdraw (amount, savcheck);
            cout << "Please enter the checknumber: ";
            getline (cin, checknumber);
            cout << "Please enter whose order the check should be paid to: ";
            getline (cin, payee);
            checking_file (user, checknumber, checkfile, payee, amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }
    else
    {
        if (amount <= user.print_savings())
        {
            user.withdraw (amount, savcheck);
            savings_file (user, savnumber, savfile, "Withdrawal", amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }
}

void trans (bank &user, double &amount, apstring savcheck, int savnumber, ofstream &savfile, apstring checknumber, ofstream &checkfile)
//This function will ask the user from which account he/she wants to transfer and the amount that should be transfered
{
    cout << "Please enter the amount of money you want to transfer: $";
    cin  >> amount;
    if (savcheck == "Checking" || savcheck == "checking")
    {
        if (amount <= user.print_checking())
        {
            user.transfer (amount, savcheck);
            savings_file (user, savnumber, savfile, "Transf from Checking", amount);
            checking_file (user, " ", checkfile, "Transf to Savings", amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }
    else
    {       
        if (amount <= user.print_savings())
        {
            user.transfer (amount, savcheck);
            savings_file (user, savnumber, savfile, "Transf to Checking", amount);
            checking_file (user, " ", checkfile, "Transf from Savings", amount);
        }
        else cout << "You entered an invalid entry, please reconsider it.\n";
    }       
}

void print (bank &user, apstring savcheck)
//This function prints the balance of either the checking or the savings account
{
    if (savcheck == "Checking" || savcheck == "checking")
        cout << "Current Checking balance: $" << user.print_checking () << endl;
    else    
        cout << "Current Savings balance: $" << user.print_savings () << endl;
}

void inquire (bank &user)
//This function prints out the balances for both accounts
{
    cout << "Current Checking balance: $" << user.print_checking () << endl;
    cout << "Current Savings balance: $" << user.print_savings () << endl;
}

void savings_file (bank &user, int &savnumber, ofstream &savfile, apstring operation, double amount)
//This function will output all the savings account transactions to amount text file "savings.txt"
{
    savfile << "|" << setw (10) << savnumber << setw (10) << "|" << setw (22) << operation << setw (6) << "|" << setw (10) << amount << setw (4) << "|" << setw (10) << user.print_savings () << setw (5) << "|\n";
}

void checking_file (bank &user, apstring checknumber, ofstream &checkfile, apstring payee, double amount)
//This function will output all the checking account transactions to amount text file "checking.txt"
{
    checkfile << "|" << setw (6) << checknumber << setw (6) << "|" << setw (26) <<  payee << setw (10) << "|" << setw (8) << amount << setw (6) << "|" << setw (8) << user.print_checking () << setw (7) << "|\n";
}

apstring is not set correctly for modern compilers shuch as the one you are using. It is still using the old, obsolete version of iostream. Make these changes in apstring.h

//#include <iostream.h> << delete this line
#include <iostream>  << add this and the next line
using namespace std;

Then in bank.h you must declare the return type of the methods. Below I made them void, but I didn't look at the code to see if that is actually what they should be.

//modifiers
		void deposit (const double &amount, apstring savcheck);
		void withdraw(const double &amount, apstring savcheck);
		void transfer(const double &amount, apstring savcheck);

The above will take care of the compiler errors/warnings. Next your compiler should complain about missing/unresolved errors. You will have to implement the missing methods.

Thank you
I only have 2 compile errors left

Project 4.cpp
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(6) : warning C4067: unexpected tokens following preprocessor directive - expected a newline
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(73) : error C2501: 'operator`>>'' : missing storage-class or type specifiers

Build log was saved at "file://c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Debug\BuildLog.htm"
Project 4 - 1 error(s), 1 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped


Trying to fix them now thanks

look at that line in your copy of aspstring.h -- it contains a semicolon where it shouldn't.

I have VC++ 2005 Express and get a ton of errors/warnings on apstring.cpp add the below line near the top of apstring.h to stop all the complaining about deprecated functions in string.h

#pragma warning(disable: 4996)

Hi Ancient Dragon,
I did what you said and it worked
Thanks
I only have one error left to go This one is tough
------ Build started: Project: Project 4, Configuration: Debug Win32 ------

Compiling...
Project 4.cpp
c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\APSTRING.H(39) : error C2208: 'const apstring' : no members defined using this type

Build log was saved at "file://c:\Documents and Settings\Robert Dovell\My Documents\Visual Studio Projects\Project 4\Debug\BuildLog.htm"
Project 4 - 1 error(s), 0 warning(s)


---------------------- Done ----------------------

Build: 0 succeeded, 1 failed, 0 skipped

I don't get that error. Check your file against the one you posted in the previous thread. Or post the offending line of that file.

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.