Help!!!!1

Suppose you start with 100 dollars in your account and every year it becomes 1.04 times what you had last year (because there is 4% interest). Write a program that tells you how much money you will have in your account for each of the next 25 years.
How about you study a bit instead of making us do your homework?
im trying and im taking notes on everything that i been helped on. but i need to get this done and i've been stuck on these problems all day. i appreciate the help i've been getting.
Here's one way to do it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include <iomanip>

struct Pennies
{
    unsigned _pennies ;
};

Pennies& operator*=(Pennies& p, double value)
{
    p._pennies *= value ;
    return p ;
}

std::ostream& operator<<(std::ostream& os, Pennies p) ;

int main()
{
    Pennies balance = { 10000 } ;

    for ( unsigned years_passed = 1 ; years_passed <= 25; ++years_passed )
        std::cout << "Year" << std::setw(3) << years_passed << ": " << (balance *= 1.04) << '\n' ;
}

std::ostream& operator<<(std::ostream& os, Pennies p)
{
    return os << std::fixed << std::setprecision(2) << (static_cast<double>(p._pennies) / 100.0) ;
}
Topic archived. No new replies allowed.