# zain-snippet/student-cli architecture

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

- Interactive diagram: https://gitdiagram.com/zain-snippet/student-cli
- Repository: https://github.com/zain-snippet/student-cli

## Overview

This is an interactive C++ student-record manager. The user enters through the command-line menu, then can create, inspect, search, or delete in-memory student records and separately save, display, load, or clear the Student.txt file. The menu also reports lifetime and current counts. The graph reflects the sampled implementation: menu dispatch is centralized in manage_inputs, while the feature functions directly operate on the vector or file. Student.txt is documented and used by code, but is not present in the supplied file tree.

Main entry points: [`Functions.cpp`](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp) (Input menu), [`Student.cpp`](https://github.com/zain-snippet/student-cli/blob/main/Student.cpp) (Student model), [`main.cpp`](https://github.com/zain-snippet/student-cli/blob/main/main.cpp) (Program entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry"]
  node_main["Program entry<br/>[main.cpp]"]
  node_menu["Input menu<br/>[Functions.cpp]"]
end

subgraph group_records["Student records"]
  node_student_model["Student model<br/>[Student.cpp]"]
  node_memory[("In-memory records")]
  node_add["Add student<br/>[Functions.cpp]"]
  node_display["Display records<br/>[Functions.cpp]"]
  node_search["Search student<br/>[Functions.cpp]"]
  node_delete["Delete student<br/>[Functions.cpp]"]
  node_clear_memory["Clear memory<br/>[Functions.cpp]"]
  node_count["Student counts<br/>[Functions.cpp]"]
end

subgraph group_persistence["File persistence"]
  node_save["Save records<br/>[Functions.cpp]"]
  node_load["Load or display file<br/>[Functions.cpp]"]
  node_clear_file["Clear file<br/>[Functions.cpp]"]
  node_student_file[("Student.txt")]
end

node_user(("User"))

node_user -->|"starts"| node_main
node_main -->|"calls"| node_menu
node_user -->|"selects"| node_menu
node_menu -->|"dispatches"| node_add
node_menu -->|"dispatches"| node_display
node_menu -->|"dispatches"| node_search
node_menu -->|"dispatches"| node_delete
node_menu -->|"dispatches"| node_clear_memory
node_menu -->|"dispatches"| node_save
node_menu -->|"dispatches"| node_load
node_menu -->|"dispatches"| node_clear_file
node_menu -->|"dispatches"| node_count
node_add -->|"adds records"| node_memory
node_add -->|"constructs"| node_student_model
node_display -->|"reads"| node_memory
node_display -->|"displays fields"| node_student_model
node_search -->|"searches"| node_memory
node_search -->|"reads fields"| node_student_model
node_delete -->|"removes records"| node_memory
node_delete -->|"reads fields"| node_student_model
node_clear_memory -->|"clears"| node_memory
node_count -->|"counts current"| node_memory
node_count -->|"reads lifetime count"| node_student_model
node_save -->|"reads records"| node_memory
node_save -->|"writes"| node_student_file
node_load -->|"reads"| node_student_file
node_load -->|"appends records"| node_memory
node_clear_file -->|"truncates"| node_student_file

click node_main "https://github.com/zain-snippet/student-cli/blob/main/main.cpp"
click node_menu "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_student_model "https://github.com/zain-snippet/student-cli/blob/main/Student.cpp"
click node_add "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_display "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_search "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_delete "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_clear_memory "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_count "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_save "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_load "https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp"
click node_clear_file "https://github.com/zain-snippet/student-cli/blob/main/Functions.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_main,node_menu,node_user toneBlue
class node_student_model,node_memory,node_add,node_display,node_search,node_delete,node_clear_memory,node_count toneAmber
class node_save,node_load,node_clear_file,node_student_file toneMint
```

## Components

### CLI entry

- [Program entry](https://github.com/zain-snippet/student-cli/blob/main/main.cpp): `main.cpp`
- [Input menu](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`

### Student records

- [Student model](https://github.com/zain-snippet/student-cli/blob/main/Student.cpp): `Student.cpp`
- **In-memory records**
- [Add student](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Display records](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Search student](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Delete student](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Clear memory](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Student counts](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`

### File persistence

- [Save records](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Load or display file](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- [Clear file](https://github.com/zain-snippet/student-cli/blob/main/Functions.cpp): `Functions.cpp`
- **Student.txt**

### Other components

- **User**

## Connections

- User → Program entry: starts
- Program entry → Input menu: calls
- User → Input menu: selects
- Input menu → Add student: dispatches
- Input menu → Display records: dispatches
- Input menu → Search student: dispatches
- Input menu → Delete student: dispatches
- Input menu → Clear memory: dispatches
- Input menu → Save records: dispatches
- Input menu → Load or display file: dispatches
- Input menu → Clear file: dispatches
- Input menu → Student counts: dispatches
- Add student → In-memory records: adds records
- Add student → Student model: constructs
- Display records → In-memory records: reads
- Display records → Student model: displays fields
- Search student → In-memory records: searches
- Search student → Student model: reads fields
- Delete student → In-memory records: removes records
- Delete student → Student model: reads fields
- Clear memory → In-memory records: clears
- Student counts → In-memory records: counts current
- Student counts → Student model: reads lifetime count
- Save records → In-memory records: reads records
- Save records → Student.txt: writes
- Load or display file → Student.txt: reads
- Load or display file → In-memory records: appends records
- Clear file → Student.txt: truncates
