I am writing a program that should allow the user to enter however many payroll amounts they want for 3 different stores. It should then display the total payroll for the three stores. The first time through the loop is fine but the second time through, even though it appears that the loop conditions still have not been met, it immediately goes to the end of the program. Any suggestions? (Please keep in mind I've been coding for less than a month)
#include <iostream>
using namespace std;
int main()
{
int numStore= 1;
int payrollAmount= 0;
int totalPayroll= 0;
do
{
totalPayroll+= payrollAmount;
cout << "Store " << numStore << ":" << endl;
while (payrollAmount >= 0)
{
cout << "Enter Payroll Amount (Negative Number to Stop): $";
cin >> payrollAmount;
}
numStore +=1;
} while (numStore < 4);
cout << "Total Payroll: $" << totalPayroll << endl;
return 0;
}