A blazing-fast, type-safe command-line calculator with CGPA support, random number generation, and formatted output. Built with Rust’s safety guarantees.
- ➕ Basic Math:
+,-,*,/,% - 🎓 CGPA Calculator: Compute semester GPA/CGPA
- 🎲 Random Numbers: Generate within a range
- ✨ Pretty Output: Colorized results (via
std::fmt) - 📊 Calculation History: Last 5 operations saved
**Output:**
```text
┌──────────────┬────────┐
│ Course │ Grade │
├──────────────┼────────┤
│ 3 credits │ A │
│ 4 credits │ B │
│ 2 credits │ D │
└──────────────┴────────┘
CGPA: 3.54/4.0
calc random --min 10 --max 50 # Random integer between 10-50src/
├── cgpa.rs # CGPA logic (grade mapping, weighted average)
├── operation.rs # Root arithmetic operations
├── shunting_yard.rs # Implementation of shunting yard algorithm. Prioritizing PEMDAS
├── shunting_yard/ # Directory for shunting yard operationn
│ └── operation.rs # Subroot arithmetic operations used in Shunting yard
└── main.rs # CLI interface
To add features (e.g., SGPA support):
- Implement logic in
cgpa.rs - Add tests:
#[test] fn test_cgpa_calculation() { assert_eq!(calculate_cgpa(&[3, 4], &["A", "B+"]), 3.45); }
- Submit a PR!