C++ program of Virtual base class to display the cube of the number
Write a program in C++ to display the cube of the number upto a given integer by 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 |
#include<iostream> using namespace std; class T4Tutorials { public: int i; }; class A:public virtual T4Tutorials { }; class B:public virtual T4Tutorials { public: int n; }; class D: public A,B { public: void disp() { cout<<"enter the Number"<<endl; cin>>n; for(i=1;i<=n;i++) { cout<<"cube of "<<i<<"is ="<<(i*i*i)<<endl; } } }; int main() { D obj; obj.disp(); } |
FAQ
Develope a program in c++ to display the cube of the number upto given an integer by using the virtual base class in OOP.
c++ program to find cube of a number by using the virtual base class in OOP.
display cube numbers in c++ by using the virtual base class in OOP.
write a basic program to input any number and display its cube by using the virtual base class in OOP.
calculate and display cube of an integer by using the virtual base class in OOP.