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);
}