source file name: hierar.cpp

 #include<stdio.h>
#include<conio.h>
#include<iostream.h>

class A
{
public:
void sqcube(int n)
{
int s=n*n;
int c=n*n*n;
cout<<"\n square "<<s << " cube " <<c;
}
} ;

class B: public A
{
public:
void oddeven(int n)
{
cout<<"\n "<< n;
if(n%2==0)
cout<<" number is Even ";
else
cout<<" number no is Odd ";
}
};

class C : public A
{
public:
void psnv(int n)
{
cout<<"\n "<< n;
if(n>0)
cout<<" number is Positive ";
else
cout<<" number is Negative  ";
}
};

void main()
{
clrscr();
cout<<"Hierarchical Inheritance program: ";
B ob1;
ob1.sqcube(10);
ob1.oddeven(15);
C ob2;
ob2.sqcube(7);
ob2.psnv(-25);
getch();
}

output: