i have to create a program that calculates how many weeks it will take to become a millionaire given an allowance of pennies.
for example...
1st week - 1 cent
2nd week - 2 cents
3rd week - 4 cents
4th week - 8 cents
5th week - 16 cents
so forth, so on...
i sort of need help getting started. so far, i only have a basic equation to begin such program..
(2 ^ n - 1)
in which n is the number pennies of that week.
the total goal is 1,000,000 in dollars, which is 100,000,000 pennies.
i am unsure how to set anything up. so far, i only have...
#include <iostream>
#include <iomanip>
using namespace std;
#include <cmath>
int main()
{
total = ((2 * pow(n)) - 1);
cout << fixed;
cout << setprecision(2);
cout << "In " << weeks << " weeks, I'll be a millionaire." << endl;
cin.ignore();
cin.get();
return 0;
}
can anyone leave me some suggestions how to get going with this program?