SE 3800 C++ Debugging Notes

My program crashes with "core dumped"

The starting point is to determine where the program crashed. Once you find where, then try to figure out why. If you can run the program from an IDE like Eclipse, you should be able to get a stack dump that will show you. An alternative is to add output statements so you can see which line was executed last. Remember that cout is "buffered" - output is stored until there is enough to force it to be written (flushed). Executing
        cout << endl;
flushes the buffer, but you can also make cout be unbuffered by adding the statement
        cout.setf(ios::unitbuf);
as the first statement in main().