While (more) doesn't stop accepting input

This is the part of my program I believe I am having issues at. The program compiles, I input transactions, even up to day 30, however after inputting up to day 30 and over of transactions it doesn't stop input and begin the computer balance function. The program runs on online compilers and computes balances perfectly. However in MS Visual Studio 2013 after transaction day 30 it continues to accept input and doesn't start computing balances. Any guidance on how to correct this issue would be most appreciated.

Full Code here:
http://pastebin.com/QruzFqqn


const int MAX_DAY = 30;

void Statement::read()
{
cout << "Enter Transactions in DAY AMOUNT DESCRIPTION format: " << endl;
bool more = true;
while (more)
{
Transaction t;
t.read();
if (cin.fail())
more = false;
else
transactions.push_back(t);
}
compute_balances();
}

void Statement::compute_balances()
{
int day;
int i = 0;
double balance = 0;
for (day = 1; day <= MAX_DAY; day++)
{
while (i < transactions.size() && transactions[i].get_day() == day)
{
balance = balance + transactions[i].get_amount();
i++;
}
daily_balances.push_back(balance);
}
}
After all the transactions have been entered, type in CTRL+Z immediately followed by Enter

On windows, this simulates an EOF on standard input.
Topic archived. No new replies allowed.