c++异常

xiaoxiao2021-02-28  134

#define _CRT_SECURE_NO_WARNINGS #include <iostream> using namespace std; class NumberException {}; int returnNumber(int n) throw(NumberException) { if (n == 0) { throw NumberException(); } return n; } int main() { int n; try { cin >> n; returnNumber(n); } catch (NumberException) { cout << " aaaaaaaaa " << endl; } system("pause"); return 0; }
转载请注明原文地址: https://www.6miu.com/read-21040.html

最新回复(0)