Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <typeinfo>
- using namespace std;
- /*template <class T>
- void printEx(T x)
- {
- cout<< typeid(x).name() ;///+ " exception: " +x<<endl;
- }
- */
- int main()
- {
- try
- {
- //char* s="GGEZ";
- //int s=10;
- //float s=1.999;
- char s='#';
- throw s;
- }
- //12.1
- catch(int e)
- {
- cout<<"int exception:"<<e<<endl;
- }
- catch(double e)
- {
- cout<<"double exception:"<<e<<endl;
- }
- catch(char e)
- {
- cout<<"Char exception:"<<e<<endl;
- }
- catch(char* e)
- {
- cout<<"Char* exception:"<<e<<endl;
- }
- //12.2
- catch(...)
- {
- cout<<"Other exception"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement