⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 except1.cpp

📁 UC Library Extensions UnderC comes with a pocket implementation of the standard C++ libraries, wh
💻 CPP
字号:
#include <iostream>
#include <string>
#include <uc_except.h>
using namespace std;

void do_something()
{
  throw string("help");
}

bool test_except( )
{
 bool ok = false;
 try {
   throw(1);
 } catch(int val) {
   ok = val==1;
 }
 try {
   do_something();
 } catch(string s) {
   ok = s=="help";
 }
 try {
   int i = 0, k = 20/i;
 } catch(Exception& e) {
   cerr << "what!\n";
 }
 return ok;
}

int main()
{
 if (! test_except()) {
   cerr << "Exception test failed" << endl;
   return -1;
 }
 return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -