Quick actions

cmd+k|ctrl+k

Navigation

Languages

CppPrimer_ex5_25

Snippet info

Language

Cpp

Visibility

public

Author

legacy-v1-32

Created

2017-01-06T08:49:03Z

Updated

2017-01-06T08:49:55Z

#include <iostream>
#include <stdexcept>
using namespace std;

int main() {
    
    while(cout << "Input two integers:\n") {
        int i,j;
        cin>>i>>j;
        try {
            if (j==0)
                throw runtime_error("divisor is 0");
            cout << i/j << endl;
        } catch (runtime_error err) {
            cout << err.what() << endl;
            
        }
        
    }
    return 0;
}
INFO