This is the pattern I need: ( the last two triangles are suppossed to have the h
ID: 3627024 • Letter: T
Question
This is the pattern I need: ( the last two triangles are suppossed to have the hypotenuse on the left side, but for some reason this web site is not letting me put it like that and invert them.
*
**
***
****
*****
******
*******
********
*********
**********
**********
*********
********
*******
******
*****
****
***
**
*
**********
*********
********
*******
******
*****
****
***
**
*
*
**
***
****
*****
******
*******
********
*********
**********
// AsteriskTriangles.cpp
// Draw four triangles composed of asterisks.
#include
using namespace std;
int main()
{
Triangles application; // create Triangles object
application.drawTriangles(); // call its drawTriangles function
} // end main
Explanation / Answer
please rate - thanks
if this is wrong message me
#include<iostream>
using namespace std;
class Triangles
{public:
void drawTriangles()
{
int i,j;
for(i=0;i<10;i++)
{for(j=0;j<=i;j++)
cout<<"*";
cout<<endl;
}
for(i=10;i>0;i--)
{for(j=0;j<i;j++)
cout<<"*";
cout<<endl;
}
for(i=10;i>0;i--)
{for(j=0;j<10-i;j++)
cout<<" ";
{for(j=0;j<i;j++)
cout<<"*";
cout<<endl;
}
}
for(i=0;i<10;i++)
{for(j=0;j<10-i-1;j++)
cout<<" ";
{for(j=0;j<=i;j++)
cout<<"*";
cout<<endl;
}
}
}
};
int main()
{
Triangles application; // create Triangles object
application.drawTriangles(); // call its drawTriangles function
system("pause");
return 0;
} // end main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.