#include <iostream>
using namespace std;
class Savings {
public:
double balance;
double rate;
Savings(double b, double r) : balance(b), rate(r) {}
void pass_year() {
balance *= (1 + rate);
}
};
int main() {
Savings sv(1000000, 0.1);
sv.pass_year();
sv.pass_year();
cout << (int)sv.balance << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: