int crddit( );
int debit();
void setBalance(int);
int getBalance();
private:
int blance;
};
#endif
--------------------------------------------------------------
//Account.cpp
#include<iostream>
using namespace std;
#include "Account.h"
Account::Account(int i)
{
if(i>=0)
setBalance(i);
else
{
setBalance(0);
cout<<"invalid number";
}
}
int Account::crddit()
{
int add=0;
cout<<"input you want to add to number:";
cin>>add;
blance+=add;
cout<<"the blance after add:"<<getBalance()<<endl;
}
int Account::debit()
{
int dicre=0;
cout<<"input you want to dicre number:";
cin>>dicre;
if (dicre<=blance)
{
blance-=dicre;
cout<<"the blance after dicre:";
}
else
cout<<"Debit amount exceeded account blance"<<getBalance()<<endl;