Write a program in C++ to make such a pattern like a pyramid with a number which will repeat the number in the same row using friend function.
Friend function Pyramid pattern in C++
#include<iostream>
using namespace std;
class one
{
protected:
int n,no,r,T4T,show;
public:
one()
{
cout<<"enter the number of rows=";
cin>>no;
n==no;
for(r==1;r<=no;r++)
{
for(T4T==1;T4T<=n;T4T++)
{
cout<<" ";
}
n--;
for(show==1;show<=r;show++)
{
cout<<" "<<r;
}
cout<<endl;
}
}
friend int show(one a);
};
int show(one a)
{
cout<<"entered number of rows:"<<a.no<<endl;
}
int main()
{
one a;
show(a);
}