# faridacherifch-source/simple-calculator architecture

> Architecture diagram of the GitHub repository faridacherifch-source/simple-calculator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/faridacherifch-source/simple-calculator
- Repository: https://github.com/faridacherifch-source/simple-calculator

## Overview

A small interactive C++ calculator: the user selects an operation, enters values through the console, and receives a printed result. The single source file implements arithmetic, power, roots, trigonometry, logarithms, and two derivative approaches. The operation nodes represent branches within `main`, not separate modules; the derivative estimate additionally calls `f`.

Main entry points: [`simple_calculator.cpp`](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp) (Menu loop)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_terminal["Console"]
node_main["Menu loop"]
node_arithmetic["Basic arithmetic"]
node_power["Power"]
node_roots["Roots"]
node_trig["Trigonometry"]
node_logs["Logarithms"]
node_derivatives["Derivatives"]
node_f["Square function"]

node_user -->|"enters choices"| node_terminal
node_main -->|"prompts and reads"| node_terminal
node_terminal -->|"supplies input"| node_main
node_main -->|"selects branch"| node_arithmetic
node_main -->|"selects branch"| node_power
node_main -->|"selects branch"| node_roots
node_main -->|"selects branch"| node_trig
node_main -->|"selects branch"| node_logs
node_main -->|"selects branch"| node_derivatives
node_arithmetic -->|"prints result"| node_terminal
node_power -->|"prints result"| node_terminal
node_roots -->|"prints result"| node_terminal
node_trig -->|"prints result"| node_terminal
node_logs -->|"prints result"| node_terminal
node_derivatives -->|"prints result"| node_terminal
node_derivatives -->|"evaluates function"| node_f

click node_main "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_arithmetic "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_power "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_roots "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_trig "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_logs "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_derivatives "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp"
click node_f "https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.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_terminal toneIndigo
class node_main,node_arithmetic,node_power,node_roots,node_trig,node_logs,node_derivatives,node_f toneTeal
```

## Components

### Other components

- **User**
- **Console**
- [Menu loop](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Basic arithmetic](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Power](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Roots](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Trigonometry](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Logarithms](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Derivatives](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`
- [Square function](https://github.com/faridacherifch-source/simple-calculator/blob/main/simple_calculator.cpp): `simple_calculator.cpp`

## Connections

- User → Console: enters choices
- Menu loop → Console: prompts and reads
- Console → Menu loop: supplies input
- Menu loop → Basic arithmetic: selects branch
- Menu loop → Power: selects branch
- Menu loop → Roots: selects branch
- Menu loop → Trigonometry: selects branch
- Menu loop → Logarithms: selects branch
- Menu loop → Derivatives: selects branch
- Basic arithmetic → Console: prints result
- Power → Console: prints result
- Roots → Console: prints result
- Trigonometry → Console: prints result
- Logarithms → Console: prints result
- Derivatives → Console: prints result
- Derivatives → Square function: evaluates function
