#include <iostream> #include <cassert> using namespace std; int main() { int a; cin >> a; assert(a>0); //assert,a>0时没问题,a<=0时 程序抛出异常 cout << a << endl; system("pause"); }
#include <iostream> #include <cassert> using namespace std; int main() { int a; cin >> a; assert(a>0); //assert,a>0时没问题,a<=0时 程序抛出异常 cout << a << endl; system("pause"); }