#include using namespace std; main(){ try{ for (;;) new char [1000000]; } catch (bad_alloc) { cerr << "memory exhausted\n"; } }