virtual base class C++ program to display the sum of the series
Write a program in C++ to display the sum of the series by using the virtual base class.
C++ program to find sum of series by using the virtual base class. summation c++ by using the virtual base class.
different series programs in c++ by using the virtual base class.
c++ calculate series by using the virtual base class. Sum c++ by using the virtual base class.
C++ loop sum numbers by using the virtual base class. C++ program to calculate sum of 10 numbers by using the virtual base class.
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 37 38 39 40 41 42 43 44 |
#include<iostream> using namespace std; class A { public: int n; }; class B:virtual public A { public: int i; }; class C:virtual public A { public: int k; }; class D:public B,public C { public: int sum; public: t4tutorials()
{ cout<<"enter any number"; cin>>n; k=9; for(i=1;i<=5;i++) { sum=sum+k; k=k*10+9; } cout<<"series"<<sum<<endl; } }; int main() { D d; d.t4tutorials(); } |