注:这里只是我的代码出现这种情况及对应的解决办法,你的代码不一定出现和我一样的情况.左移这篇随笔仅供参考. 运行程序出现如下结果: terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc Process returned 3 (0x3) execution time : 5.837 s Press any key to continue. 然后发现是 for 循环里面的,本应写成…