#include <iostream>

using namespace std;

  void func(int x)

{

   try

   {

      if(x==1)

        throw x;

      else

        if(x==0) throw 'p';

        else

        if(x==-1) throw 1.0;

        cout<<" NO Exception " << "X value " << x;

        cout<<"\n End of try block\n ";

   } 

   catch(int n) 

   {

      cout << "Caught  an Integer \n";

   }

   catch(char ch)

   {

       cout<< "Caught a Character \n";

   }

   catch(double d)

   {

       cout<<" Caught a double \n ";

         }

  cout<< " End of try-catch system\n";

 }

int main() 

{

    cout<<" Testing of Multiple catches \n";

   func(0);

   func(1);

   func(-1);

   func(2);

   return 0;

}

output:

Testing of Multiple catches 

Caught a Character 

 End of try-catch system

Caught  an Integer 

End of try-catch system

 Caught a double 

  End of try-catch system

NO Exception X value 2

 End of try block

  End of try-catch system