In the code, a float value 1.8f is thrown using the throw statement. The try block is used to catch the thrown exception. There are three catch blocks provided to catch exceptions of different types:
After the catch blocks, "End" will be printed to the console.
#include<iostream> using namespace std; int main() { try { throw 1.8f; } catch(int e) { cout<<"Integer Catch : "<<e<<endl; } catch(float e) { cout<<"Float Catch : "<<e<<endl; } catch(...) { cout<<"All Catch : "<<endl; } cout<<"End"; return 0; }To download raw file Click Here
Float Catch : 1.8 End
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions