#include<iostream>
using namespace std;
class A
{
public:
	int n;
	void insert()
	{           cout<<"Enter the number::"<<endl;
		cin>>n;
	}	
};
class B : public A
{
public:
            int i,f=1;
	 void facto()
	 {
	 	for(i=1;i<=n;i++)
	 		f=f*i;
	 	cout<<"Factorial::"<<f<<endl;
	 }	
};
class C : public A
{public:
	 int s;
	 void square()
	 { 	s=n*n;
	 	cout<<"Square::"<<s<<endl;
	 }
};
class D : public A
{public:
	int c;
	void cube()
	{	c=n*n*n;
		cout<<"Cube::"<<c<<endl;
	}	
};
int main()
{	B obj1;
	C obj2;
	D obj3;
	obj1.insert();
	obj1.facto();
	obj2.insert();
	obj2.square();
	obj3.insert();
	obj3.cube();
	return 0;
}
Sqrcub.cpp
Subscribe to:
Post Comments (Atom)
- 
Capgemini has issued a notification for the recruitment of Architect Posts Vacancy at Various posts. Interested candidates can apply by At...
- 
#include<iostream> using namespace std; int n; class Array { public: int ar[50]; void getval() { cout<...
- 
MasterCard has issued a latest notification for the recruitment of Manager, Specialist & Engineer Post Vacancy at Various posts.Othe...
 
No comments:
Post a Comment