1234567891011121314151617181920212223242526
#include<iostream> #include<exception> using namespace std; void divide(int i, int j) { if (j == 0) throw exception("\n...Divide by 0 happens..."); else cout << i << '/' << j << " = " << i/j << "..." << i%j; } int main() { int i,j; cout << "This program calcuates the quotient and remainder, " << "Please enter a number and divisor"; cin >> i >> j; try { divide (i,j); } catch (exception e) { cerr << e.what(); } }