On Sun, Nov 9, 2008 at 9:52 AM, prakashshukla <[EMAIL PROTECTED]> wrote:
> #include<iostream.h>
> I am experimenting with the following program for error handling. I
> get an error on the word try as "unrecognized word". Pl help
>
> #include<conio.h>
> void test(int i)
> {
> try
> {if(i!=0) throw i;
> else throw "Zero";}
> catch(int a)
> {cout<<"Caught an int"<<a<<endl;}
> catch(char *s)
> { cout<<"Caught a string"<<s<<endl;}
> };
> void main()
> {
> clrscr();
> test(1);
> test(23);
> test(O);
> getch();
> }
I'm not sure, but I think Turbo C++ is so old it doesn't support
exception handling (it didn't when I was using Turbo C++ back in the
early 90s). Time to upgrade to MS Visual C++!
-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
If I were to divulge it, it would overturn the world."
-- Jelaleddin Rumi