#include<iostream> #include<stdexcept> using namespace std; int main() { int a,b; label: cin>>a>>b; try { if(b==0)throw runtime_error("重输"); cout<<a/b<<endl; } catch(runtime_error err) { cout<<err.what() <<"重输"<<endl; goto label; } return 0; }
#include<iostream> #include<stdexcept> using namespace std; int main() { int a,b; label: cin>>a>>b; try { if(b==0)throw runtime_error("重输"); cout<<a/b<<endl; } catch(runtime_error err) { cout<<err.what() <<"重输"<<endl; goto label; } return 0; }