异常处理

来源:互联网 发布:网络暴力形成的原因 编辑:程序博客网 时间:2024/04/29 02:39


//异常处理
//writed by swords 2005/3/15

#include<iostream.h>

void main()
{
 cout<<"start"<<endl;
 try
 {
  cout<<"inside try block."<<endl;
  throw 200;
  cout<<"this will not execute.";
 }
 catch(int i)
 {
  cout<<"catch an exeception--value is: "<<i<<endl;
 }
 cout<<"end!";
}