Class Objects C++ program to print mirrored right triangle star pattern
Write a C++ program to print mirrored right triangle star pattern series using class objects.
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 |
#include<iostream> using namespace std; class pat { protected : int i,j,r; 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() { pat a; a.patern(); } |
How to print right triangle star pattern series with trailing spaces of n rows using for loop in C++ using class objects.
Logic to print mirrored right triangle star pattern series in C programming using class objects.
Output