#include<iostream.h>
#include<conio.h>
class b1
{
public:
int a,b;
void setdata();
int getdata(void);
void show(void);
};
class d1:public b1
{
public:
int c;
void display(void);
};
void b1::setdata(void)
{
a=10;
b=5;
}
int b1::getdata()
{
return a;
return b;
}
void b1::show()
{
cout<<"\n A= "<<a;
cout<<"\n B= "<<b;
cout<<"\n A+B= "<<a+b;
cout<<"\n A-B= "<<a-b;
cout<<"\n A*B= "<<a*b;
cout<<"\n A/B= "<<a/b;
cout<<"\n A*A= "<<a*a;
cout<<"\n B*B= "<<b*b;
}
void d1::display()
{
cout<<"\n A= "<<a;
cout<<"\n B= "<<b;
cout<<"\n C= "<<c;
}
void main()
{
clrscr();
d1 d2;
d2.setdata();
d2.show();
d2.c=20;
cout<<"\n";
d2.display();
getch();
}
#include<conio.h>
class b1
{
public:
int a,b;
void setdata();
int getdata(void);
void show(void);
};
class d1:public b1
{
public:
int c;
void display(void);
};
void b1::setdata(void)
{
a=10;
b=5;
}
int b1::getdata()
{
return a;
return b;
}
void b1::show()
{
cout<<"\n A= "<<a;
cout<<"\n B= "<<b;
cout<<"\n A+B= "<<a+b;
cout<<"\n A-B= "<<a-b;
cout<<"\n A*B= "<<a*b;
cout<<"\n A/B= "<<a/b;
cout<<"\n A*A= "<<a*a;
cout<<"\n B*B= "<<b*b;
}
void d1::display()
{
cout<<"\n A= "<<a;
cout<<"\n B= "<<b;
cout<<"\n C= "<<c;
}
void main()
{
clrscr();
d1 d2;
d2.setdata();
d2.show();
d2.c=20;
cout<<"\n";
d2.display();
getch();
}
No comments:
Post a Comment