唯C更漂亮

VC。。。。。。

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  12 随笔 :: 0 文章 :: 6 评论 :: 0 Trackbacks
void main()
{
    string enterStr;
    cout<<"Please enter a string:"<<endl;
    cin>>enterStr;

    try
    {
        if(enterStr=="push")
        {
            push("Push Error!");        
        }
        else
        {
            pop("Pop Error!");
        }
    }
    catch(string &str)
    {
        cerr<<"Exception Error:  "<<str<<endl;
    }
}

void push(string str) throw(string)
{
    cout<<"Now is Push!"<<endl;
    throw string(str);
}
void pop(string str) throw(string)
{
    cout<<"Now is Pop!"<<endl;
    throw string(str);
}
posted on 2007-04-16 18:16 唯C程序猿 阅读(113) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理