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
#include<iostream>
usingnamespace 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;
}
}