Showing posts with label Catch. Show all posts
Showing posts with label Catch. Show all posts

Friday, 27 April 2012

Program Of Conversion Between Objects To Basic Type

#include<iostream.h>
#include<conio.h>
class add
{
private:
int a,b;
public:
add(int x)
{
a=x;
}

{
return a;
}

void show()
{
cout<<"a is="<<a;
}
};
main()
{
clrscr();


------- Object to BAsic ------ 

int r;
add a1(4);
a1.show();
r=a1;
cout<<"\n Value of r="<<r;
getch();
}

Program Of Exception Handling In C++

#include<iostream.h>
#include<conio.h>
main()
{
int a,b,c;
clrscr();
a=7;
b=2;
{
c=a/b;
cout<< c;
}
{
   cout<<"Divide By Zero Error";
}

getch();
}