Hi, i'm willing to print a pyramid but it's not working quite good my programme is followings:
Anyone please help me..:) NOTE:"REMEMBER, you can't use extra things in this programme except bool variables and if, if else statements as they are prohibited and that's the MAIN task"
#include<iostream>
using namespace std;
int main()
{
int size,half,mode,left,right;
cout<<"Please, enter the size of the base of the pyramid ";
cin>>size;
mode=size%2;
if(mode=1)
{
half=(size-1)/2;
left=half;
right=half;
for(int line=1;line<=(size-half);line++)
{
while(left<half && left>0)
{
cout<<"L";
left--;
}
for(int stars=1;stars<=(line+(line-1));stars++)
{
cout<<"*";
}
while(right<half && right>0)
{
cout<<"R";
right--;
}
cout<<endl;
left=half--;
right=half-1;
if(left<0 && right<0)
{
break;
}
}
}
else
{
cout<<"Please enter odd positive integer to get complete and desired pyramid\n";
}
return 0;
}