While-loop wont do the loops

Alright, i am trying to fix this loop problem but i cant understand whats wrong with it. In my eyes it should do the loop but it wont and i cant understand why.





Here is my whole code

#include <iostream>

using namespace std;
int main()
{
double in= 0;
cout << "Hur mycket du vill sätta in varje \x86r: ";
cin >> in;

cout << "Ange ditt sparmål: ";
double goal = 0;
cin >> goal;

cout << "Ange räntesatsen i procent: ";
double ranta = 0;
cin >> ranta;
ranta = (ranta / 100 + 1);
double balance = 0;


int year;
year = 0;

while (balance < goal);
{
balance = balance*ranta + in;
++year;

}
cout << "Ditt sparmål uppnås efter " << year << " år" << endl;
cout << "Ditt saldo kommer att vara " << balance << " kr" << endl;

}


The program is made to ask you to enter a amount u save every year, then what your save goal is. and also at what interestrate you have, soo while i enter in 1000 into the "in" and take 5000 as a saving "goal" and just take 5 as interest.
it wont do the loop at all and i cant understand why. 0 is less then 5000 why wont it do the loop?
 
while (balance < goal);


The semicolon terminates the while statement. Remove the semicolon.

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Thank you so much! i was going crazy over this!

Yes sorry for that!
Topic archived. No new replies allowed.