Ideas for how to debug program crashes and logic errors:
strip abc.exeThis removes all debug information and can make it more likely your program will crash.
cerr << x;Standard error is not buffered.
#include <cassert> double average(const double nums[], int size) { assert(size > 0); // OR: if ( size <= 0 ) throw "bad size"; ... }Once you find the condition that fails, start working backwards through the execution sequence to find the first incorrect computed result. Then figure out what to fix.
Note the order: find the first place your code goes wrong and then find the error. You are more likely to be struck by lightening than to fix code without knowing the cause.
if ( size <= 0 ) assert(size > 0);Place a breakpoint on the assertion so you can see what lead to it.