A C++ decision-support tool that ranks apartments using a weighted multi-criteria score of price, living space and noise level. It has an interactive command-line app and a small web interface built on cpp-httplib.
=== Ranked Apartments (Best to Worst) ===
----------------------------------------
1. Suburban House
2. Quiet Apartment
3. Downtown Studio
4. City Loft
5. Luxury Penthouse
Weights Used:
Price: 40%
Space: 35%
Noise: 25%
- Weighted scoring: price (lower is better), space (higher is better), noise (lower is better)
- Adjustable weights: customize what matters to you; weights are normalized to 100%
- Weight profiles: save and load your preferences to and from a file
- CSV import: load a list of apartments in one go
- Interactive CLI: add, view, rank and clear apartments from a menu
- Web interface: add apartments, tweak weights and see rankings in the browser
Requires a C++17 compiler (g++ or clang) and make.
make # build both the CLI and the web server into build/
make run # start the CLI
make web # start the web server on http://localhost:8080
make clean # remove build outputEach apartment gets a weighted cost score, and the lowest score ranks first:
score = price × w_price + (1000 − space) × w_space + noise × w_noise
| Criterion | Default weight | Better when |
|---|---|---|
| Price | 40% | lower |
| Space | 35% | higher (sq ft, measured against 1000) |
| Noise | 25% | lower (0–100 scale) |
- Add apartment
- View all apartments
- Rank apartments
- Customize weights
- Load apartments from file
- Save weights profile
- Load weights profile
- Clear all apartments
- Exit
ID,Price,Space,Noise
Downtown Studio,1800,650,45
Suburban House,1200,1100,25
City Loft,2200,800,60
A sample file is included as apartments.csv, and weights_profile.txt is an example saved weight profile.
.
├── include/
│ ├── apartment.h # Apartment model
│ └── evaluator.h # Scoring and ranking
├── src/
│ ├── main.cpp # Interactive CLI
│ ├── apartment.cpp
│ ├── evaluator.cpp
│ └── web_server.cpp # Web interface (cpp-httplib)
├── external/httplib.h # Single-header HTTP library
├── apartments.csv # Sample data
└── Makefile
- CSV upload in the web interface (currently CLI only)
- Location and commute-time criteria
- Amenities scoring
- Normalize criteria to a common scale (raw price currently outweighs noise)
- Unit tests