Multilevel inheritance C+ Program Armstrong number of n digits

Write a program in C+ to check Armstrong’s number of n digits using multilevel inheritance in object-oriented programming.

#include<iostream>
#include<math.h>
using namespace std;
class T4Tutorials
{
	protected:
	int n1,num,result=0;
};
class T4Tutorials2:public T4Tutorials

{
   protected:
   	int n=0;
   	int r;
};
class T4tutorials_child: public T4Tutorials2
{

  public:
		int function()
		{
		cout<<"check wether the number is armstromg or not :"<<endl;
	cin>>n;	
	num=n1;
	while(num!=0)
	{
		num/=10;
		n++;
	}
	num=n1;
	while(num !=0)
	{
		r=num%10;
		result+=pow(r , n);
		num /=10;
	}
	if(result==n1)
	cout<<"is an armstrong number :"<<endl;
	else
	cout<<" is not an armstrong number :"<<endl;
}
};
int main()
{
	T4tutorials_child obj;
	obj.function();
}




Output

check whether the number is Armstrong or not :

90 is not an Armstrong number :

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.