Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Current »
#include "stdafx.h"
#include <string>
#include <iostream>
#include "classesandobjects.h"
using namespace std;
typedef struct Account
{
string accNo;
double balance;
};
double debit(Account& _this, double amt)
{
return (_this.balance -= amt);
}
double credit(Account& _this, double amt)
{
return (_this.balance += amt);
}
bool isOverDrawn(const Account& _this)
{
return _this.balance < 0;
}
void handleStructures()
{
// Using a structure...
Account acc = { "Sels", 45.00 };
double result = debit(acc, 23);
result = credit(acc, 45);
result = debit(acc, 89);
bool od = isOverDrawn(acc);
}
int main()
{
handleStructures();
return 0;
}