Project 1: Personal Finance Aggregator
A command-line tool that reads transaction data from a CSV file, calculates total spending per category, and prints a sorted summary report.
Quick Reference
| Attribute | Value |
|---|---|
| Primary Language | C++ |
| Alternative Languages | Python, Rust |
| Difficulty | Level 1: Beginner |
| Time Estimate | Weekend |
| Knowledge Area | Data Processing / STL Basics |
| Tooling | A CSV parsing library (or write a simple one). |
| Prerequisites | Basic C++ syntax (structs, functions, I/O). |
What You Will Build
A command-line tool that reads transaction data from a CSV file, calculates total spending per category, and prints a sorted summary report.
Why It Matters
This project builds core skills that appear repeatedly in real-world systems and tooling.
Core Challenges
- Parsing CSV data → maps to string manipulation,
std::string,std::stringstream - Storing transaction records → maps to using a
std::vectorofstructs - Aggregating spending by category → maps to using
std::map<string, double>to associate keys with values - Sorting the final report → maps to using
std::sortwith a custom lambda to sort a vector of pairs
Key Concepts
std::vector: The default container. (cppreference.com)std::map: Key-value association. (cppreference.com)std::sortwith Lambdas: Custom sorting logic. (cppreference.com)- Range-based for loops: The modern way to iterate.
Real-World Outcome
date,category,amount
2023-10-01,Groceries,-50.25
2023-10-02,Transport,-15.00
2023-10-02,Groceries,-25.50
Implementation Guide
- Reproduce the simplest happy-path scenario.
- Build the smallest working version of the core feature.
- Add input validation and error handling.
- Add instrumentation/logging to confirm behavior.
- Refactor into clean modules with tests.
Milestones
- Milestone 1: Minimal working program that runs end-to-end.
- Milestone 2: Correct outputs for typical inputs.
- Milestone 3: Robust handling of edge cases.
- Milestone 4: Clean structure and documented usage.
Validation Checklist
- Output matches the real-world outcome example
- Handles invalid inputs safely
- Provides clear errors and exit codes
- Repeatable results across runs
References
- Main guide:
LEARN_CPP_STL_DEEP_DIVE.md - “A Tour of C++” by Bjarne Stroustrup