Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Still need help with this C++ shape program its suppose to print 6 shapes using

ID: 3646615 • Letter: S

Question

Still need help with this C++ shape program its suppose to print 6 shapes using * and give the user the option to choose size and shape. Thank you!




#include <iostream>
#include <iomanip>
#include <cmath>
#include<string>

using namespace std;

void triangle1(int );
void triangle2(int );
void triangle3(int );
void triangle4(int );
void diagonal(int );
void diagonal2(int);

void triangle1(int p)
{
for(int i=0;i<=p;++i)
{
for(int j=0;j<i;++j)
{
cout<<"*";
}

}
}
void triangle2(int p)
{
for(int i=p;i>0;--i)
{
for(int j=0;j<i;++j)
{
cout<<"*";
}

}
}
void triangle3(int p)
{
for(int i=p;i>0;--i)
{
for(int j=0;j<i;++j)
{
cout<<"*";
}

for(int r=p;r>=i;--r)
{
cout<<" ";
}
}
}
void triangle4(int p)
{
for(int i=0;i<=p;++i)
{
for(int r=p;r>i;--r)
{
cout<<" ";
}
for(int j=0;j<i;++j)
{
cout<<"*";
}

}
}
void diagonal(int p)
{
for(int i=0;i<p;++i)
{
cout<<"*";

}
}
void diagonal2(int p)
{
for(int i=p;i>0;--i)
{


class shape
{
void main(string args[])
{
string s=args[0];

int n = atoi(args[1].c_str());
string s1="triangle1";
cout<<s;
draws obj=new draws();
if(s==s1)
{
obj.triangle1(n);
}
if(s=="triangle2")
{
obj.triangle2(n);
}
if(s=="triangle3")
obj.triangle3(n);
if(s=="triangle4")
obj.triangle4(n);
if(s=="diagonalup" | s=="diagonaldown")
obj.diagonal(n);

}
}

Explanation / Answer

Wats the problem you are facing did u compile it?

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote