# Thread: quite newbish program not working

1. ## quite newbish program not working

someone please help, ive only been programming for a few days and saw something similar in a tutorial i read and thought id try it but it wont out put anything

Code:
```#include <iostream>

using namespace std;

int main()
{
int monthlyexpenses = 300 + 200 + 75;
int monthlyincome = 1000;
float monthlyinterest = .02;
float total = 0;
float x = total;
float interestearned = 0;
for (x = 1; x <= 12;)
interestearned = monthlyincome * monthlyinterest;
total = total + interestearned + monthlyincome - monthlyexpenses; {
cout<< total <<endl;
}
}```

2. You never change the value of x.

3. Code:
`for (x = 1; x <= 12;)`
The for-loop is incomplete. make it e.g. for (x = 1; x <= 12; x++)

4. ## Another thing

[QUOTE=littlelefty7]someone please help, ive only been programming for a few days and saw something similar in a tutorial i read and thought id try it but it wont out put anything

Code:
```    float x = total;
for (x = 1; x <= 12;)```
Why set X to total when on almost the very next line you set it to 1? Also, I'm assuming x is the number of months (because of 1 to 12 loop) so it doesn't make much sense to set the month number to a dollar value. Also, x is a floating point and you should be using an int type for a loop counter.

5. get rid of.
float x = total;

do this
Code:
```for(int i=0; i<12; ++i) {
...
}```
this will give you your 12 loops..

if that example you posted is the style of the tutorial, then find new tutorials..

there are plenty of tuts on this site..

<unrelated> wow! forcing to use code tags now.. Excellent!

6. thanks for all the help like ive said ive only been programming for a few days and i dont quite konw what im doing yet. the entire program wasnt on the tutorial just part of it and i tried to make the rest. thanks for the help, by the way i got it to work.