TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/airgead-investment-calculator/llms.txt
Use this file to discover all available pages before exploring further.
source/ folder preserves the original Airgead Banking console application written in C++. This is the program that the web version was designed to replicate. The console app accepts the same four inputs and prints two formatted reports — one without monthly deposits and one with.
Source Files
| File | Purpose |
|---|---|
airgeadBankingApp.cpp | Entry point: collects the four inputs and calls the Investment display methods |
investment.h | Declares the Investment class, YearlyInvestmentResult struct, and public interface |
investment.cpp | Implements calculation logic and formatted console report output |
Compile and Run
Sample Session
The following shows what the console application looks like when run with example inputs:Input Validation
The main loop uses two helper functions to ensure that all user-provided values are valid before constructing theInvestment object:
readNonNegativeDouble()— used for the starting balance, monthly deposit, and annual interest rate. Repeats the prompt if the input fails to parse or is negative.readPositiveInteger()— used for the number of years. The entered value must be a whole number greater than 0; any other input causes the prompt to repeat.
cin.clear() and cin.ignore() to flush the input stream before retrying, preventing an infinite loop on bad input.
Relationship to the Web Version
The C++ source uses the same monthly compounding formula as the JavaScript version. The key difference is that the C++
calculateWithMonthlyDeposit() adds the deposit before applying interest each month, while the JavaScript version applies interest first then adds the deposit. The final balance figures differ slightly as a result. Both models demonstrate the educational concept of compound growth.