#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
void DisplayTitle();
void DisplayBal(double);
void GetData(int& , double&);
double ProcessCheck(double, double);
double ProcessDeposit(double, double);
double ProcessATM(double, double);
double ProcessSvcChg(double);
struct transrec
{
double credids;
double debits;
double service charges;
};
const double CHARGE = 10,
ATMFEE = 2;
int main()
{
int transCode;
double balance,
transAmt;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
DisplayTitle();
GetData(transCode, transAmt);
ifstream input;
ofstream output;
input.open("C:\\checkin.dat", ios::app);
if ( input.fail())
{
cout<< " Input file failed to open\n";
system("pause");
exit(1);
}
output.open("C:\\checkout.txt",ios::app);
if ( output.fail())
{
cout<< "output file opening failed\n";
system("pause");
exit(1);
}
transrec GetData (ifstream& file)
{
transRec temp;
file >> temp.code >> temp.amt;
return temp;
}
while(transCode !=0 )
{
switch(transCode)
{
case 1: balance = ProcessCheck(balance, transAmt); break;
case 2: balance = ProcessDeposit(balance, transAmt); break;
case 3: balance = ProcessATM(balance, transAmt); break;
}
DisplayBal(balance);
if(balance < 0)
balance = ProcessSvcChg(balance);
GetData(transCode, transAmt);
}
return 0;
}
void DisplayTitle()
{
cout << "\n Check Register\n\n";
}
void DisplayBal(double x)
{
cout << "\t\tBalance = $" << setw(10) << x;
}
void GetData(int& x, double& y)
{
}
}
double ProcessCheck(double bal, double amt)
{
cout << "\n Check = " << setw(10) << amt;
return (bal - amt);
}
double ProcessDeposit(double bal, double amt)
{
cout << "\n Deposit = " << setw(10) << amt;
return (bal + amt);
}
double ProcessATM(double bal, double amt)
{
cout << "\n ATM = " << setw(10) << amt;
bal = bal - amt;
DisplayBal(bal);
bal = bal - ATMFEE;
cout << "\n ATM Fee = " << setw(10) << ATMFEE;
return (bal);
}
double ProcessSvcChg(double bal)
{
cout << "\n Service chg =" << setw(8) << CHARGE;
bal = bal - CHARGE;
DisplayBal(bal);
return (bal);
}
problem is it i compile it with no error messages afterwards i get 14 when i try any ideas? any helpw ould be greatful