I am working on program and I need to fix some small errors, you don't need to fix the program because it is not done yet, but if you can help me fix the compiling error, especially the first error that will help.
main //not much is done ,just check for file open and closeCODE
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
#include "account.h"
#include "savings.h"
int Account::NDM =0;
int Account::NW =0;
int main()
{
ifstream infile;
char filename[14];
cout <<"Enter the filename: ";
cin >>filename;
fileOpen(filename, infile);
fileClose(infile);
return 0;
}
void fileOpen(char filename[14], ifstream& infile)
{
infile.open(filename);
if (infile.fail())
{
cerr << "\a\nERROR 1: File could not be opened."<<endl;
exit(1);
}
else
{
cout << "\nThe external file has been successfully opened for writing."<<endl;
}
return;
}
void fileClose(ifstream& infile)
{
infile.close();
if (infile.fail())
{
cerr << "\a\nERROR 2: File could not be closed."<< endl;
exit(2);
}
else
{
cout <<"\nThe external file has been successfully closed."<<endl;
}
return;
}
Account.hCODE
class Account
{
protected:
static int NDM,NW;
double MIR,MI,bal,MonScharge;
float Ai,money;
public:
Account(int);
void deposit(int);
void withdraw(int);
void calclnt();
void MonthlyProc();
};
Account::Account(int mon):bal(0.0),Ai(0.0)
{
money = mon;
NDM++;
NW++;
}
void Account::deposit(int mon)
{
money = mon;
bal = bal+money;
return;
}
void Account::withdraw(int mon)
{
money = mon;
bal = bal-money;
return;
}
void Account::calclnt()
{
MIR = Ai/12;
MI = bal*MIR;
bal = bal+MI;
return;
}
void Account::MonthlyProc()
{
bal = bal-MonScharge;
calclnt();
NW=0;
NDM=0;
MonScharge=0;
return;
}
Savings.hCODE
class Savings:protected Account
{
public:
void withdraw();
void deposit(int);
void MonthlyProc();
};
void Savings::withdraw()
{
{
if (bal >= 25)
Account::withdraw(int)
NW++;
}
else
{
cerr <<"\nSorry balance is below $25 *Can't withdraw*"<<endl;
}
return;
}
void Savings::deposit(int)
{
money = mon;
if(bal+money >= 25.0)
{
Account::deposit(int);
NDM++;
}
else
{
cout <<"\nSorry the money your depositing will not make the account active."<<endl;
}
return;
}
void Savings::MonthlyProc()
{
if(NW >4)
{
MonScharge=1;
Account::MonthlyProc();
}
else
{
Account::MonthlyProc();
}
if(bal =>25)
{
cout <<"\nAccount is Active."<<endl;
}
else
{
cout <<"\nAccount is Inactive."<<endl;
}
return;
}