In: Computer Science
Write a C++ program fragment which illustrates the throwing and
catching of a logic_error while performing a division in the case
of division by zero.
#include <iostream> #include <string> using namespace std; int main() { int a = 5, b = 0; try { cout<<(a/b); } catch (const char* msg1) { cout<<msg1<<endl; } return 0; }