Subscribe Us

Responsive Advertisement

Advertisement

Exception Handling Multiple catch statements in cpp

 





#include<bits/stdc++.h>

using namespace std;


int main()

{

  int x;

  double y;

  x=10;

y=20.5;

  try

  {

      throw x;

      ;


  }


catch(int n)

  {

      cout<<"Error in (INT)\n";

  }

  try

  {

      throw y;

  }

  catch(double n)

  {

      cout<<"Error in (double)\n";

  }


    return 0;

}


Post a Comment

0 Comments