TESTING THROW RESTRICTIONS
< iostream >
using namespace std;
test( x) throw(,)
{
(x==0) ‘x’;
(x==1);
(x==-1) 1.0;
cout<<“End of the function block \n”;
}
main()
{
{
cout << “Testing throw restrictions \n”;
cout << “X==0 \n”;
test(0);
cout << “x==1 \n”;
test(1);
cout << “x==-1 \n;
test(-1);
cout << “x==2 \n”;
test(2);
}
( c)
{
cout << “caught a character \n”;
}
( m)
{
cout << “caught an integer \n”;
}
( d)
{
cout << “caught a double \n”;
}
cout << “End of try catch system \n\n”;
}
|