help please

I'm having a problem with the while loop. I want it to continue to loop until the user enters 0 but instead it will only go forward when 0 is entered. What have i done wrong

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  #include<iostream>

using namespace std;
void getInfo( int , int &, int);

int main() 
{

int overUnder=0;
int budget=0;
int expenses;
int total=0;

cout<<"Are you over budget?"<<endl;
cout<<"Lets find out."<<endl;

getInfo( budget , expenses , total );

cout<<"Your total expenses are $"<< total <<endl;

overUnder = total - budget;

if (overUnder >= 0)
	cout<<"You are over your budget by $"<< overUnder<<endl;
if (overUnder < 0)
	cout<<"You are under your budget by $"<< overUnder<<endl;



 system ("pause");
 return 0;

}

void getInfo( int budget , int &expenses , int total )
{

	cout<<"What is your Monthly budget?"<<endl;
	cin>>budget;

	cout<<"Please Enter Your Expenses. (Or enter 0 to end)"<<endl;
	cin>>expenses;

	while( expenses != 0 );
	{
		cout<<"Enter Expense"<<endl;
		cin>>expenses;
		total = total + expenses;

	}
}
Remove the ";" after while(expenses != 0); on line 44.
Topic archived. No new replies allowed.