I am relatively new to C++ and have an assignment due. We have to print out a parallelogram using helper functions. We are supposed to use the right_angle_function twice and a rectangle function to create the different pieces of the shape.

I got the most of it to print out and work except for the second right angle triangle. I can't get the loop to print out decreasing amounts of #'s and increasing amounts of spaces...

Here's my code so far, theboldedarea is the tricky part for me:

Here's what it prints out for h= 11 w= 4:Code:# include <iostream> using namespace std; void right_angle_triangle (int h, int w, int d) { //Define the new height of the triangle based on the height of the whole paraellelogram int trih= w-1; //Create a loop that will form a right angle triangle for the top part of the paraellelogram if (d==1) { for (int i=0; i<=trih; i++) { for (int j=0; j<=i; j++) { cout<<"# "; } cout<<endl; } } //Create a loop that will form a right angle triangle for the bottom part of the paraellelogramif (d==3){for (int i=trih; i>=1; --i){{cout<<" ";}for(int j=i; j<=i; ++j){cout<<"# "<<endl;}}} } void rectangle(int h, int w) { //Define the new variable for the rectangle height int recth= h-2*w+1; //Create the loop that will rectangle that will form the middle part of the parallelogram for(int i=0; i<recth; i++) { for(int j=0; j<w; j++) cout << "# "; cout << endl; } } int main() { //Define varibles int h, w, d; //Tell the user to input the height and width of the triangle cout<< "Please insert the height and width of the parallelogram you wish to create: "; cin>>h>>w; //Send the inputted height and width and different directions of the triangles to helper functions to print out the separate pieces of the paraellelogram right_angle_triangle (h, w, d=1); rectangle (h, w); right_angle_triangle (h, w, d=3); }

#

# #

# # #

# # # #

# # # #

# # # #

# # # #

# # # #

___#

___#

___#Thank you!!