Write a C++ Program to display the reverse of a number using the Virtual base Class in Object Oriented Programming(OOP).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
#include<iostream> using namespace std; class T4Tutorials { public: int i,n; int in() { cout<<"Please Enter the number to Show the reverse of a number."; cin>>n; } }; class second: virtual public T4Tutorials { }; class third:virtual public T4Tutorials{ }; class display:public second,public third { public: int disp() { T4Tutorials::in(); cout<<" Output: the reverse of a number of the number is: "; for(i=0;i<n;n=n/10) { cout<<n%10; } } }; int main() { display d; d.disp(); } |
Output
Please Enter the number to Show the reverse of a number. 568.
Output: the reverse of a number of the number is: 865.
Some FAQ
c++ program to reverse a number without using loop using the Virtual base Class in Object Oriented Programming(OOP).
c++ program to find reverse of a number using function using the Virtual base Class in Object Oriented Programming(OOP).
write a program to reverse a number in c++ using for loop using the Virtual base Class in Object Oriented Programming(OOP).
c++ program to reverse a number using array using the Virtual base Class in Object Oriented Programming(OOP).
c++ program to reverse a number using recursion using the Virtual base Class in Object Oriented Programming(OOP).
The reverse a number in c++ using the Virtual base Class in Object Oriented Programming(OOP).