This program is just allowing me to enter the income and not the expenses. I need a program that allows you to enter the income and expense amounts, which will always be intergers. The number of income and expense amounts may vary each time the program is compiled.
#include <iostream>
usingnamespace std;
int main()
{
//Variables
int incomes = 0;
int expenses = 0;
int totalIncome = 0;
int totalExpenses = 0;
int profit = 0;
// bring loop
while (incomes >= 0)
{
totalIncome += incomes;
cout << "Enter an income value (negative value to stop): ";
cin >> incomes;
}
while (expenses >+ 0)
{
totalExpenses += expenses;
cout << "Enter an expense value (negative value to stop): ";
cin >> expenses;
}
//calculate profit (or loss)
profit = totalIncome - totalExpenses;
//display totals and the profit
cout << "Total income is $" << totalIncome << endl;
cout << "Total expenses is $" << totalExpenses << endl;
cout << "Profit is $" << profit << endl;
system("pause");
return 0;
}
//end of main function