C++ Bank Project

A long, long time ago, in a galaxy far, far away...

Actually, it was only about 10 years ago, and it was in my basement. I was just getting back into programming with C++, and I took on a programming challenge that I found online.

The challenge:
Create a database for a bank [referred to as Same-Diff Bank, for reasons unknown to this author], that uses binary files to store information about the bank's customers, the customers' accounts, and their account intormation.

It should be secure– using passwords to prevent customers from gaining access to administrative accounts or other customers' accounts.

It should also have at least four classes– a Bank, a Customer, an Account, and it should also have an ATM class for access to Accounts.

Use all the programming skills you have learned up to this point– classes, vectors, pointers, data structures, binary files, etc.


I started off by creating a UML diagram of what I needed. After approximately 5,000 revisions, I was finally satisfied. Unfortunately, I had some issues with my job which took a couple of weeks to resolve, but I finally got back to it.

After a week of the occasional attempt to start it, I finally made a promise to myself to finish it all in one night (absolutely bonkers). After a hectic 5 hours or so of endless typing, retyping, and eureka moments, I finally had it error/warning-free! Finished!

...Or so I thought. Debugging took another couple hours, as it was riddled with logic errors and stuff that just didn't work. I finally remembered that I could use vectors instead of dynamic arrays, and then I wouldn't have to make a whole bunch of custom functions!

I finally finished around 4 AM, saved my work, and entered
c++ -g -Wall -o same-diff-bank same-diff-bank.cc

into the terminal, followed by
./same-diff-bank

and was interrupted by a pop-up reminder on my screen saying "Leave for work in 5 minutes." My groan of protest ended up being more of a croak as I called in "sick" and staggered off to bed.

Anyway, after my long and rambling prelude, here is the aforementioned bank project. I didn't want to post the code here, as the headers are rather long (between 200 and 1200 lines), but they're on my Pastebin– here are the links:

Driver: https://pastebin.com/1PeFcP5y
Bank Header: https://pastebin.com/7rpKn4sC
Customer header: https://pastebin.com/stYv3mqA
Account header: https://pastebin.com/SE54mhwP
ATM header: https://pastebin.com/HxKwG8Zy

The driver is actually short enough to post here:
1
2
3
4
5
6
7
8
#include <iostream>
#include "bank.h"

int main ()
{
	Bank SameDiffBank;
	SameDiffBank.login();
}


Doesn't seem like much to control headers that are 1200 lines long, but that's C++ for ya.

I originally tried to make this an article, but it hasn't been approved for a few months, and the site admin seems to have taken AWOL, so there you go.

This is...how do I say this...raw code? As in, it doesn't work super well, and I used a weird file format for the binary storage, and there may have been a few issues that I didn't find in the debugger.

Thanks for reading!
max
Last edited on
I take it present-day you isn't looking for a code review?

-Albatross
If you rewrote it today, would you do it differently?
I take it present-day you isn't looking for a code review?

If you've got the time and energy (and strong stomach) to go copy/paste and test the code that 10-years-ago me wrote, then sure! I probably don't have the energy, or the stomach for it. I just thought someone might be interested in C++ archaeology (if that's a thing), since it should be all C++11 (there may be some C++13 mixed in, if I edited it more recently. I can't remember. Getting old sucks).

kbw,
Probably. Back then I was exclusively using C++11, since that was in 2012 and that was the most recent version. These days, I'm mainly using C++13 and bits and pieces of C++17-20. Some stuff my compiler won't handle, although I can use the -std=c++2a flag so it at least does parts of C++20. In case you didn't know, I use clang++ v10 on my Mac for compiling, through the command line in Terminal. Yes, I'm weird.
Last edited on
Topic archived. No new replies allowed.