Subscribe Us

Responsive Advertisement

Advertisement

Exception Handling and Function in cpp

 





#include<bits/stdc++.h>

using namespace std;

void check(int n)

{

    try

    {

        if(n==20)throw n;

        cout<<n<<endl;

    }

    catch(int a)

    {

        cout<<"NOT USED\n";

    }

}

int main()

{

    check(10);

    check(20);

    check(30);



    return 0;

}


Post a Comment

0 Comments