Write a C++ Program to display the pattern like pyramid using the alphabet by using the virtual base class in Object Oriented Programming.
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 46 47 48 49 50 51 52 53 54 55 56 57 58 |
#include<iostream> using namespace std; class T4Tutorials { public: int i; }; class p1:public virtual T4Tutorials { public: int k; }; class p2:public virtual T4Tutorials { public: int ct=1; }; class derived:public p1,p2 { public: int num,bl,ct=1; char alp='A'; public: int show() { int ct=1;char alp='A'; cout<<"Input the number of Letters (<26) in the pyramid:"; cin>>num; } int T4Tutorials() { for(i=1;i<=num;i++) { for(bl=1;bl<=num-i;bl++) { cout<<" "; } for(k=0;k<=(ct/2);k++) { cout<<" "<<alp++; } alp=alp-2; for(k=0;k<(ct/2);k++) { cout<<" "<<alp--; } ct=ct+2; alp= 'A'; cout<<"\n"; } } }; int main() { derived obj; obj.show(); obj.T4Tutorials(); } |
Output
FAQ
C++ program to print pyramid pattern by using the virtual base class in OOP.
all alphabet pattern programs in c++ by using the virtual base class in OOP .
C++ program to print patterns of alphabets by using the virtual base class in OOP .
Develop a C++ program to print pyramid of numbersby using the virtual base class in OOP.
C++ program to print alphabets series by using the virtual base class in OOP.
write a program in c to make such a pattern like a pyramid with alphabets by using the virtual base class in OOP.