# zainhassanbangash/atm-simulator architecture

> Architecture diagram of the GitHub repository zainhassanbangash/atm-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zainhassanbangash/atm-simulator
- Repository: https://github.com/zainhassanbangash/atm-simulator

## Overview

This is a small, single-file C++ ATM simulator. The user selects an option in the console; `main` dispatches to balance check, deposit, or withdrawal, then continues its menu loop until exit. Deposit and withdrawal read amounts and display results through the console. The balance is held in `main` and passed to the operation functions. The excerpt shows no persistent storage. Notably, the initial balance is uninitialized, and the balance-check option passes zero directly. All shown relationships are evidenced by the sole source file.

Main entry points: [`ATM_SIMULATOR.cpp`](https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp) (Menu loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("ATM user"))
node_console["Console"]
node_main["Menu loop<br/>[ATM_SIMULATOR.cpp]"]
node_balance["Balance check<br/>[ATM_SIMULATOR.cpp]"]
node_deposit["Deposit<br/>[ATM_SIMULATOR.cpp]"]
node_withdraw["Withdrawal<br/>[ATM_SIMULATOR.cpp]"]

node_user -->|"chooses option"| node_console
node_console -->|"provides choice"| node_main
node_main -->|"shows menu"| node_console
node_main -->|"calls"| node_balance
node_main -->|"calls"| node_deposit
node_main -->|"calls"| node_withdraw
node_deposit -->|"reads amount"| node_console
node_deposit -->|"displays result"| node_console
node_withdraw -->|"reads amount"| node_console
node_withdraw -->|"displays result"| node_console
node_balance -->|"returns balance"| node_main
node_deposit -->|"returns updated balance"| node_main
node_withdraw -->|"returns balance"| node_main

click node_main "https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp"
click node_balance "https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp"
click node_deposit "https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp"
click node_withdraw "https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_user toneBlue
class node_console toneIndigo
class node_main,node_balance,node_deposit,node_withdraw toneTeal
```

## Components

### Other components

- **ATM user**
- **Console**
- [Menu loop](https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp): `ATM_SIMULATOR.cpp`
- [Balance check](https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp): `ATM_SIMULATOR.cpp`
- [Deposit](https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp): `ATM_SIMULATOR.cpp`
- [Withdrawal](https://github.com/zainhassanbangash/atm-simulator/blob/main/ATM_SIMULATOR.cpp): `ATM_SIMULATOR.cpp`

## Connections

- ATM user → Console: chooses option
- Console → Menu loop: provides choice (evidence: `ATM_SIMULATOR.cpp`)
- Menu loop → Console: shows menu (evidence: `ATM_SIMULATOR.cpp`)
- Menu loop → Balance check: calls (evidence: `ATM_SIMULATOR.cpp`)
- Menu loop → Deposit: calls (evidence: `ATM_SIMULATOR.cpp`)
- Menu loop → Withdrawal: calls (evidence: `ATM_SIMULATOR.cpp`)
- Deposit → Console: reads amount (evidence: `ATM_SIMULATOR.cpp`)
- Deposit → Console: displays result (evidence: `ATM_SIMULATOR.cpp`)
- Withdrawal → Console: reads amount (evidence: `ATM_SIMULATOR.cpp`)
- Withdrawal → Console: displays result (evidence: `ATM_SIMULATOR.cpp`)
- Balance check → Menu loop: returns balance (evidence: `ATM_SIMULATOR.cpp`)
- Deposit → Menu loop: returns updated balance (evidence: `ATM_SIMULATOR.cpp`)
- Withdrawal → Menu loop: returns balance (evidence: `ATM_SIMULATOR.cpp`)
