#include <iostream>
#include <exception>
using namespace std;
void
unexpectedHandler ()
{
cout << "Unexpected!" << endl;
}
void
terminateHandler ()
{
cout << "Terminate!" << endl;
}
int
main (int argv, char *argc[])
{
int a;
int b;
try
{
if (argv < 3)
throw exception ();
a = atoi (argc[1]);
b = atoi (argc[2]);
}
catch (exception e)
{
a = 2;
b = 0;
}
set_unexpected (unexpectedHandler);
set_terminate (terminateHandler);
try
{
cout << a / b << endl;
}
catch (...)
{
cout << "Shit happens!" << endl;
}
return 0;
}
Ответ на:
комментарий
от imp
Ответ на:
комментарий
от imp
Ответ на:
комментарий
от imp
Ответ на:
комментарий
от omerm
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.
Похожие темы
- Форум Багофича эксепшенов с++ ? (2013)
- Форум Валится на throw (2005)
- Форум Продолжим про исключения!! (2007)
- Форум Как правильно наследовать от std::exception ? (2007)
- Форум Множественное наследование и try/catch inderect base, C++ (2008)
- Форум C++ простая программа (2014)
- Форум C++ iostream::failbit (2005)
- Форум Не компилируется программа :( (2008)
- Форум [C++] Почему не работает самопальный str_replace (2011)
- Форум ofstream (2006)