C++ program to print mirrored right triangle star pattern using 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 45 |
#include<iostream> using namespace std; class grand { public : int i; }; class p1:virtual public grand { public : int j; }; class p2:virtual public grand { public : int r; }; class derived:public p1,public p2 { public : int patern() { cout<<"input No of rows : "; cin>>r; for(j=1 ; j<=r ; j++) { for(i=j ; i<r ; i++) { cout<<" "; } for(
i=1 ; i<=j ; i++) { cout<<"*"; } cout<<"\n"; } } }; int main() { derived a; a.patern(); } |
Output
mirrored inverted right triangle star pattern in C++ by using the virtual base class.
C++ program to print right triangle star pattern by using the virtual base class.
hollow right triangle star pattern in C++ by using the virtual base class.
star pattern programs in C++ using for while loop by using the virtual base class.
c++ programming pattern by using the virtual base class.
c++ star triangle by using the virtual base class.
hollow mirrored right triangle star pattern in C++ by using the virtual base class.